本文整理汇总了Java中org.kuali.rice.core.api.util.io.SerializationUtils.deepCopy方法的典型用法代码示例。如果您正苦于以下问题:Java SerializationUtils.deepCopy方法的具体用法?Java SerializationUtils.deepCopy怎么用?Java SerializationUtils.deepCopy使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.kuali.rice.core.api.util.io.SerializationUtils
的用法示例。
在下文中一共展示了SerializationUtils.deepCopy方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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();
}
}
示例2: 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");
}
}
示例3: 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;
}