本文整理汇总了Java中org.kuali.rice.core.api.util.io.SerializationUtils类的典型用法代码示例。如果您正苦于以下问题:Java SerializationUtils类的具体用法?Java SerializationUtils怎么用?Java SerializationUtils使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
SerializationUtils类属于org.kuali.rice.core.api.util.io包,在下文中一共展示了SerializationUtils类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: processCollectionRetrieveEditLineDialog
import org.kuali.rice.core.api.util.io.SerializationUtils; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public void processCollectionRetrieveEditLineDialog(ViewModel model, String collectionId, String collectionPath,
int selectedLineIndex) {
String objectPath = collectionPath + "[" + selectedLineIndex + "]";
// get the line instance for editing the line
Object dataObject = ObjectPropertyUtils.getPropertyValue(model, objectPath);
if (dataObject == null) {
logAndThrowRuntime("Unable to get collection property from model for path: " + objectPath);
}
// don't update the dialog object unless its null cause it means there are unsaved changes
if (((UifFormBase) model).getDialogDataObject() == null) {
((UifFormBase) model).setDialogDataObject(SerializationUtils.deepCopy((Serializable) dataObject));
}
}
示例2: unwrapPayload
import org.kuali.rice.core.api.util.io.SerializationUtils; //导入依赖的package包/类
/**
* Extracts the payload from a PersistedMessageBO, attempts to convert it to the expected AsynchronousCall type, and
* returns it.
*
* Throws an IllegalArgumentException if the decoded payload isnt of the expected type.
*
* @param message
* The populated PersistedMessageBO object to extract the payload from.
* @return Returns the payload if one is present and it can be deserialized, otherwise returns null.
*/
protected AsynchronousCall unwrapPayload(PersistedMessageBO message) {
if (message == null || message.getPayload() == null) {
return null;
}
String encodedPayload = message.getPayload().getPayload();
if (StringUtils.isBlank(encodedPayload)) {
return null;
}
Object decodedPayload = null;
if (encodedPayload != null) {
decodedPayload = SerializationUtils.deserializeFromBase64(encodedPayload);
}
// fail fast if its not the expected type of AsynchronousCall
if ((decodedPayload != null) && !(decodedPayload instanceof AsynchronousCall)) {
throw new IllegalArgumentException("PersistedMessageBO payload was not of the expected class. " + "Expected was ["
+ AsynchronousCall.class.getName() + "], actual was: [" + decodedPayload.getClass().getName() + "]");
}
return (AsynchronousCall) decodedPayload;
}
示例3: retrieveValidationErrorsFromGlobalVariables
import org.kuali.rice.core.api.util.io.SerializationUtils; //导入依赖的package包/类
/**
* Retrieves validation errors from GlobalVariables MessageMap and appends to the given list of RemotableAttributeError
* @param validationErrors list to append validation errors
*/
protected void retrieveValidationErrorsFromGlobalVariables(List<RemotableAttributeError> validationErrors) {
// can we use KualiConfigurationService? It seemed to be used elsewhere...
ConfigurationService configurationService = CoreApiServiceLocator.getKualiConfigurationService();
if(GlobalVariables.getMessageMap().hasErrors()){
MessageMap deepCopy = (MessageMap) SerializationUtils.deepCopy(GlobalVariables.getMessageMap());
for (String errorKey : deepCopy.getErrorMessages().keySet()) {
List<ErrorMessage> errorMessages = deepCopy.getErrorMessages().get(errorKey);
if (CollectionUtils.isNotEmpty(errorMessages)) {
List<String> errors = new ArrayList<String>();
for (ErrorMessage errorMessage : errorMessages) {
// need to materialize the message from it's parameters so we can send it back to the framework
String error = MessageFormat.format(configurationService.getPropertyValueAsString(errorMessage.getErrorKey()), errorMessage.getMessageParameters());
errors.add(error);
}
RemotableAttributeError remotableAttributeError = RemotableAttributeError.Builder.create(errorKey, errors).build();
validationErrors.add(remotableAttributeError);
}
}
// we should now strip the error messages from the map because they have moved to validationErrors
GlobalVariables.getMessageMap().clearErrorMessages();
}
}
示例4: editCourse
import org.kuali.rice.core.api.util.io.SerializationUtils; //导入依赖的package包/类
@RequestMapping(method = RequestMethod.POST, params = "methodToCall=editCourse")
public ModelAndView editCourse(@ModelAttribute("KualiForm") LabsAdminRegistrationForm form, BindingResult result,
HttpServletRequest request, HttpServletResponse response) {
String selectedCollectionPath = form.getActionParamaterValue(UifParameters.SELECTED_COLLECTION_PATH);
if (StringUtils.isBlank(selectedCollectionPath)) {
throw new RuntimeException("Selected collection path was not set for collection action");
}
String selectedCollectionId = form.getActionParamaterValue(UifParameters.SELECTED_COLLECTION_ID);
String selectedLine = form.getActionParamaterValue(UifParameters.SELECTED_LINE_INDEX);
int selectedLineIndex = -1;
if (StringUtils.isNotBlank(selectedLine)) {
selectedLineIndex = Integer.parseInt(selectedLine);
}
Collection<Object> collection = ObjectPropertyUtils.getPropertyValue(form, selectedCollectionPath);
Object item = ((List) collection).get(selectedLineIndex);
cancelEdits(form, selectedCollectionId);
// TODO May want to write your own copy/clone method or alternatively re-retrieve value from db on cancel
LabsAdminRegistrationCourse
tempCourse = (LabsAdminRegistrationCourse) (SerializationUtils.clone((LabsAdminRegistrationCourse) item));
if (selectedCollectionId.equals(REG_COLL_ID)) {
form.setEditRegisteredIndex(selectedLineIndex);
form.setTempRegCourseEdit(tempCourse);
} else if (selectedCollectionId.equals(WAITLIST_COLL_ID)) {
form.setEditWaitlistedIndex(selectedLineIndex);
form.setTempWaitlistCourseEdit(tempCourse);
}
return getRefreshControllerService().refresh(form);
}
示例5: processCollectionEditLine
import org.kuali.rice.core.api.util.io.SerializationUtils; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public void processCollectionEditLine(ViewModel model, CollectionActionParameters parameterData) {
String collectionId = parameterData.getSelectedCollectionId();
String collectionPath = parameterData.getSelectedCollectionPath();
int selectedLineIndex = parameterData.getSelectedLineIndex();
// get the collection instance for editing the line
Collection<Object> collection = ObjectPropertyUtils.getPropertyValue(model, collectionPath);
if (collection == null) {
logAndThrowRuntime("Unable to get collection property from model for path: " + collectionPath);
}
// save the dialog data object to the current line
if (collection instanceof List) {
Object editLine = ((List<Object>) collection).get(selectedLineIndex);
Object dialogDataObject = ((UifFormBase) model).getDialogDataObject();
if (dialogDataObject != null) {
editLine = SerializationUtils.deepCopy((Serializable) dialogDataObject);
((UifFormBase) model).setDialogDataObject(null);
}
processBeforeEditLine(model, editLine, collectionId, collectionPath);
((List<Object>) collection).remove(selectedLineIndex);
((List<Object>) collection).add(selectedLineIndex, editLine);
processAfterEditLine(model, editLine, collectionId, collectionPath);
} else {
logAndThrowRuntime("Only List collection implementations are supported for the edit by index method");
}
}
示例6: createRangeDateField
import org.kuali.rice.core.api.util.io.SerializationUtils; //导入依赖的package包/类
/**
* creates an extra field for date from/to ranges
* @param field
* @return a new date field
*/
public static Field createRangeDateField(Field field) {
Field newDate = (Field) SerializationUtils.deepCopy(field);
newDate.setFieldLabel(newDate.getFieldLabel()+" "+KRADConstants.LOOKUP_DEFAULT_RANGE_SEARCH_LOWER_BOUND_LABEL);
field.setFieldLabel(field.getFieldLabel()+" "+KRADConstants.LOOKUP_DEFAULT_RANGE_SEARCH_UPPER_BOUND_LABEL);
newDate.setPropertyName(KRADConstants.LOOKUP_RANGE_LOWER_BOUND_PROPERTY_PREFIX+newDate.getPropertyName());
return newDate;
}
示例7: getMethodCall
import org.kuali.rice.core.api.util.io.SerializationUtils; //导入依赖的package包/类
public AsynchronousCall getMethodCall() {
if (this.methodCall != null) {
return this.methodCall;
}
this.methodCall = (AsynchronousCall) SerializationUtils.deserializeFromBase64(getPayload());
return this.methodCall;
}
示例8: testQNameSerializaion
import org.kuali.rice.core.api.util.io.SerializationUtils; //导入依赖的package包/类
@Test public void testQNameSerializaion() throws Exception {
QName qname = new QName("hi", "HI");
String qnameSerialized = SerializationUtils.serializeToBase64(qname);
SerializationUtils.deserializeFromBase64(qnameSerialized);
assertTrue(true);
}
示例9: PersistedMessagePayload
import org.kuali.rice.core.api.util.io.SerializationUtils; //导入依赖的package包/类
public PersistedMessagePayload (AsynchronousCall methodCall, PersistedMessageBO message) {
this.setPayload(SerializationUtils.serializeToBase64(methodCall));
this.methodCall = methodCall;
this.message = message;
}