RM: Rejected records bug fixes

* ensure all the record information is removed from a rejected record (seeing issue with ID being reset)
  * rejected records are ignored by the create record action
  * note:  there are still some features we need to add to expand the rejected records use case



git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/modules/recordsmanagement/HEAD@48064 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Roy Wetherall
2013-03-14 02:42:53 +00:00
parent 2bcaf4222d
commit 187d0af93b
4 changed files with 45 additions and 22 deletions

View File

@@ -124,10 +124,14 @@
parent="declarativeCapability"> parent="declarativeCapability">
<property name="name" value="CopyRecord"/> <property name="name" value="CopyRecord"/>
<property name="private" value="true"/> <property name="private" value="true"/>
<property name="kinds">
<list>
<value>RECORD</value>
</list>
</property>
<property name="conditions"> <property name="conditions">
<map> <map>
<entry key="capabilityCondition.frozen" value="false"/> <entry key="capabilityCondition.frozen" value="false"/>
<entry key="capabilityCondition.isRecord" value="true"/>
<entry key="capabilityCondition.recordFiled" value="true"/> <entry key="capabilityCondition.recordFiled" value="true"/>
</map> </map>
</property> </property>
@@ -137,10 +141,14 @@
parent="declarativeCapability"> parent="declarativeCapability">
<property name="name" value="CopyRecordFolder"/> <property name="name" value="CopyRecordFolder"/>
<property name="private" value="true"/> <property name="private" value="true"/>
<property name="kinds">
<list>
<value>RECORD_FOLDER</value>
</list>
</property>
<property name="conditions"> <property name="conditions">
<map> <map>
<entry key="capabilityCondition.frozen" value="false"/> <entry key="capabilityCondition.frozen" value="false"/>
<entry key="capabilityCondition.isRecordFolder" value="true"/>
</map> </map>
</property> </property>
</bean> </bean>
@@ -149,10 +157,14 @@
parent="declarativeCapability"> parent="declarativeCapability">
<property name="name" value="CopyRecordCategory"/> <property name="name" value="CopyRecordCategory"/>
<property name="private" value="true"/> <property name="private" value="true"/>
<property name="kinds">
<list>
<value>RECORD_CATEGORY</value>
</list>
</property>
<property name="conditions"> <property name="conditions">
<map> <map>
<entry key="capabilityCondition.frozen" value="false"/> <entry key="capabilityCondition.frozen" value="false"/>
<entry key="capabilityCondition.isRecordCategory" value="true"/>
</map> </map>
</property> </property>
</bean> </bean>

View File

@@ -229,7 +229,7 @@
<value>RECORD</value> <value>RECORD</value>
</set> </set>
</property> </property>
<property name="capability" value="CopyRecords"/> <property name="capability" value="CopyRecord"/>
</bean> </bean>
<bean id="jsonConversionComponent.copyRecordFolderAction" <bean id="jsonConversionComponent.copyRecordFolderAction"

View File

@@ -150,6 +150,14 @@ public class CreateRecordAction extends ActionExecuterAbstractBase
} }
} }
else if (nodeService.hasAspect(actionedUponNodeRef, ASPECT_RECORD_REJECTION_DETAILS) == true)
{
// can not create a record from a previously rejected one
if (logger.isDebugEnabled() == true)
{
logger.debug("Can not create record, because " + actionedUponNodeRef.toString() + " has previously been rejected.");
}
}
else else
{ {
NodeRef filePlan = (NodeRef)action.getParameterValue(PARAM_FILE_PLAN); NodeRef filePlan = (NodeRef)action.getParameterValue(PARAM_FILE_PLAN);

View File

@@ -515,7 +515,7 @@ public class RecordServiceImpl implements RecordService,
ParameterCheck.mandatoryString("Reason", reason); ParameterCheck.mandatoryString("Reason", reason);
// Save the id of the currently logged in user // Save the id of the currently logged in user
final String userId = AuthenticationUtil.getRunAsUser(); final String userId = AuthenticationUtil.getFullyAuthenticatedUser();
// do the work of rejecting the record as the system user // do the work of rejecting the record as the system user
AuthenticationUtil.runAsSystem(new RunAsWork<Void>() AuthenticationUtil.runAsSystem(new RunAsWork<Void>()
@@ -526,6 +526,9 @@ public class RecordServiceImpl implements RecordService,
// take note of the record id // take note of the record id
String recordId = (String)nodeService.getProperty(nodeRef, PROP_IDENTIFIER); String recordId = (String)nodeService.getProperty(nodeRef, PROP_IDENTIFIER);
// take node of the original document owner
String documentOwner = (String) nodeService.getProperty(nodeRef, PROP_RECORD_ORIGINATING_USER_ID);
// first remove the secondary link association // first remove the secondary link association
NodeRef originatingLocation = (NodeRef) nodeService.getProperty(nodeRef, PROP_RECORD_ORIGINATING_LOCATION); NodeRef originatingLocation = (NodeRef) nodeService.getProperty(nodeRef, PROP_RECORD_ORIGINATING_LOCATION);
List<ChildAssociationRef> parentAssocs = nodeService.getParentAssocs(nodeRef); List<ChildAssociationRef> parentAssocs = nodeService.getParentAssocs(nodeRef);
@@ -537,23 +540,24 @@ public class RecordServiceImpl implements RecordService,
break; break;
} }
} }
// remove the "record" and "file plan component" aspects // remove all RM related aspects from the node
nodeService.removeAspect(nodeRef, RecordsManagementModel.ASPECT_RECORD); Set<QName> aspects = nodeService.getAspects(nodeRef);
nodeService.removeAspect(nodeRef, ASPECT_FILE_PLAN_COMPONENT); for (QName aspect : aspects)
{
// remove "identifier" property if (RM_URI.equals(aspect.getNamespaceURI()) == true)
nodeService.removeProperty(nodeRef, PROP_IDENTIFIER); {
// remove the aspect
nodeService.removeAspect(nodeRef, aspect);
}
}
// get the records primary parent association // get the records primary parent association
ChildAssociationRef parentAssoc = nodeService.getPrimaryParent(nodeRef); ChildAssociationRef parentAssoc = nodeService.getPrimaryParent(nodeRef);
// move the record into the collaboration site // move the record into the collaboration site
nodeService.moveNode(nodeRef, originatingLocation, ContentModel.ASSOC_CONTAINS, parentAssoc.getQName()); nodeService.moveNode(nodeRef, originatingLocation, ContentModel.ASSOC_CONTAINS, parentAssoc.getQName());
// remove all extended readers
extendedSecurityService.removeAllExtendedSecurity(nodeRef);
// save the information about the rejection details // save the information about the rejection details
Map<QName, Serializable> aspectProperties = new HashMap<QName, Serializable>(3); Map<QName, Serializable> aspectProperties = new HashMap<QName, Serializable>(3);
aspectProperties.put(PROP_RECORD_REJECTION_USER_ID, userId); aspectProperties.put(PROP_RECORD_REJECTION_USER_ID, userId);
@@ -561,8 +565,7 @@ public class RecordServiceImpl implements RecordService,
aspectProperties.put(PROP_RECORD_REJECTION_REASON, reason); aspectProperties.put(PROP_RECORD_REJECTION_REASON, reason);
nodeService.addAspect(nodeRef, ASPECT_RECORD_REJECTION_DETAILS, aspectProperties); nodeService.addAspect(nodeRef, ASPECT_RECORD_REJECTION_DETAILS, aspectProperties);
// Restore the owner of the document // Restore the owner of the document
String documentOwner = (String) nodeService.getProperty(nodeRef, PROP_RECORD_ORIGINATING_USER_ID);
if (StringUtils.isBlank(documentOwner)) if (StringUtils.isBlank(documentOwner))
{ {
throw new AlfrescoRuntimeException("Unable to find the creator of document."); throw new AlfrescoRuntimeException("Unable to find the creator of document.");
@@ -570,7 +573,7 @@ public class RecordServiceImpl implements RecordService,
ownableService.setOwner(nodeRef, documentOwner); ownableService.setOwner(nodeRef, documentOwner);
// send an email to the record creator // send an email to the record creator
notificationHelper.recordRejectedEmailNotification(nodeRef, recordId); notificationHelper.recordRejectedEmailNotification(nodeRef, recordId);
return null; return null;
} }