mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-31 17:39:05 +00:00
RM-1532, RecordServiceImpl.onUpdateProperties now able to recognise that a new vale of false compared to an old value of null for a boolean property is unchanged
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/modules/recordsmanagement/HEAD@74338 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -109,7 +109,7 @@ public class RecordServiceImpl extends BaseBehaviourBean
|
|||||||
{
|
{
|
||||||
/** Logger */
|
/** Logger */
|
||||||
private static Log logger = LogFactory.getLog(RecordServiceImpl.class);
|
private static Log logger = LogFactory.getLog(RecordServiceImpl.class);
|
||||||
|
|
||||||
/** transation data key */
|
/** transation data key */
|
||||||
private static final String IGNORE_ON_UPDATE = "ignoreOnUpdate";
|
private static final String IGNORE_ON_UPDATE = "ignoreOnUpdate";
|
||||||
|
|
||||||
@@ -511,14 +511,14 @@ public class RecordServiceImpl extends BaseBehaviourBean
|
|||||||
{
|
{
|
||||||
getBehaviour("onUpdateProperties").disable();
|
getBehaviour("onUpdateProperties").disable();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see org.alfresco.module.org_alfresco_module_rm.record.RecordService#disablePropertyEditableCheck(org.alfresco.service.cmr.repository.NodeRef)
|
* @see org.alfresco.module.org_alfresco_module_rm.record.RecordService#disablePropertyEditableCheck(org.alfresco.service.cmr.repository.NodeRef)
|
||||||
*/
|
*/
|
||||||
public void disablePropertyEditableCheck(NodeRef nodeRef)
|
public void disablePropertyEditableCheck(NodeRef nodeRef)
|
||||||
{
|
{
|
||||||
Set<NodeRef> ignoreOnUpdate = TransactionalResourceHelper.getSet(IGNORE_ON_UPDATE);
|
Set<NodeRef> ignoreOnUpdate = TransactionalResourceHelper.getSet(IGNORE_ON_UPDATE);
|
||||||
ignoreOnUpdate.add(nodeRef);
|
ignoreOnUpdate.add(nodeRef);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -566,12 +566,16 @@ public class RecordServiceImpl extends BaseBehaviourBean
|
|||||||
// deal with date values
|
// deal with date values
|
||||||
propertyUnchanged = (((Date)beforeValue).compareTo((Date)afterValue) == 0);
|
propertyUnchanged = (((Date)beforeValue).compareTo((Date)afterValue) == 0);
|
||||||
}
|
}
|
||||||
|
else if ((afterValue instanceof Boolean) && (beforeValue == null) && (afterValue == Boolean.FALSE))
|
||||||
|
{
|
||||||
|
propertyUnchanged = true;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// otherwise
|
// otherwise
|
||||||
propertyUnchanged = EqualsHelper.nullSafeEquals(beforeValue, afterValue);
|
propertyUnchanged = EqualsHelper.nullSafeEquals(beforeValue, afterValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!propertyUnchanged &&
|
if (!propertyUnchanged &&
|
||||||
!(ContentModel.PROP_CONTENT.equals(property) && beforeValue == null) &&
|
!(ContentModel.PROP_CONTENT.equals(property) && beforeValue == null) &&
|
||||||
!isPropertyEditable(nodeRef, property))
|
!isPropertyEditable(nodeRef, property))
|
||||||
@@ -788,7 +792,7 @@ public class RecordServiceImpl extends BaseBehaviourBean
|
|||||||
aspectProperties.put(PROP_RECORD_ORIGINATING_USER_ID, owner);
|
aspectProperties.put(PROP_RECORD_ORIGINATING_USER_ID, owner);
|
||||||
aspectProperties.put(PROP_RECORD_ORIGINATING_CREATION_DATE, new Date());
|
aspectProperties.put(PROP_RECORD_ORIGINATING_CREATION_DATE, new Date());
|
||||||
nodeService.addAspect(nodeRef, ASPECT_RECORD_ORIGINATING_DETAILS, aspectProperties);
|
nodeService.addAspect(nodeRef, ASPECT_RECORD_ORIGINATING_DETAILS, aspectProperties);
|
||||||
|
|
||||||
// make the document a record
|
// make the document a record
|
||||||
makeRecord(nodeRef);
|
makeRecord(nodeRef);
|
||||||
|
|
||||||
@@ -833,10 +837,10 @@ public class RecordServiceImpl extends BaseBehaviourBean
|
|||||||
{
|
{
|
||||||
ParameterCheck.mandatory("nodeRef", parent);
|
ParameterCheck.mandatory("nodeRef", parent);
|
||||||
ParameterCheck.mandatory("name", name);
|
ParameterCheck.mandatory("name", name);
|
||||||
|
|
||||||
NodeRef record = null;
|
NodeRef record = null;
|
||||||
NodeRef destination = parent;
|
NodeRef destination = parent;
|
||||||
|
|
||||||
if (isFilePlan(parent))
|
if (isFilePlan(parent))
|
||||||
{
|
{
|
||||||
// get the unfiled record container for the file plan
|
// get the unfiled record container for the file plan
|
||||||
@@ -856,19 +860,19 @@ public class RecordServiceImpl extends BaseBehaviourBean
|
|||||||
{
|
{
|
||||||
throw new AlfrescoRuntimeException("Record can only be created from a sub-type of cm:content.");
|
throw new AlfrescoRuntimeException("Record can only be created from a sub-type of cm:content.");
|
||||||
}
|
}
|
||||||
|
|
||||||
disablePropertyEditableCheck();
|
disablePropertyEditableCheck();
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
// create the new record
|
// create the new record
|
||||||
record = fileFolderService.create(destination, name, type).getNodeRef();
|
record = fileFolderService.create(destination, name, type).getNodeRef();
|
||||||
|
|
||||||
// set the properties
|
// set the properties
|
||||||
if (properties != null)
|
if (properties != null)
|
||||||
{
|
{
|
||||||
nodeService.addProperties(record, properties);
|
nodeService.addProperties(record, properties);
|
||||||
}
|
}
|
||||||
|
|
||||||
// set the content
|
// set the content
|
||||||
if (reader != null)
|
if (reader != null)
|
||||||
{
|
{
|
||||||
@@ -1135,10 +1139,10 @@ public class RecordServiceImpl extends BaseBehaviourBean
|
|||||||
throw new AlfrescoRuntimeException("Unable to find the creator of document.");
|
throw new AlfrescoRuntimeException("Unable to find the creator of document.");
|
||||||
}
|
}
|
||||||
ownableService.setOwner(nodeRef, documentOwner);
|
ownableService.setOwner(nodeRef, documentOwner);
|
||||||
|
|
||||||
// clear the existing permissions
|
// clear the existing permissions
|
||||||
permissionService.clearPermission(nodeRef, null);
|
permissionService.clearPermission(nodeRef, null);
|
||||||
|
|
||||||
// restore permission inheritance
|
// restore permission inheritance
|
||||||
permissionService.setInheritParentPermissions(nodeRef, true);
|
permissionService.setInheritParentPermissions(nodeRef, true);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user