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

View File

@@ -229,7 +229,7 @@
<value>RECORD</value>
</set>
</property>
<property name="capability" value="CopyRecords"/>
<property name="capability" value="CopyRecord"/>
</bean>
<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
{
NodeRef filePlan = (NodeRef)action.getParameterValue(PARAM_FILE_PLAN);

View File

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