RM: bug fixes

* various behaviour needed to be executed as rmadmin
 * indicator shows for rejected record in collab site
 * can not see "create record" action in UI for rejected record



git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/modules/recordsmanagement/HEAD@48068 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Roy Wetherall
2013-03-14 07:47:56 +00:00
parent dbe3ec246d
commit 376dff7857
7 changed files with 86 additions and 41 deletions

View File

@@ -156,5 +156,12 @@
parent="capabilityCondition.base" parent="capabilityCondition.base"
class="org.alfresco.module.org_alfresco_module_rm.capability.declarative.condition.IsRecordCategoryCondition"> class="org.alfresco.module.org_alfresco_module_rm.capability.declarative.condition.IsRecordCategoryCondition">
</bean> </bean>
<bean id="capabilityCondition.isRejectedRecord"
parent="capabilityCondition.base"
class="org.alfresco.module.org_alfresco_module_rm.capability.declarative.condition.HasAspectCapabilityCondition">
<property name="aspectName" value="rma:recordRejectionDetails"/>
<property name="namespaceService" ref="NamespaceService"/>
</bean>
</beans> </beans>

View File

@@ -56,6 +56,7 @@
parent="org_alfresco_module_rm_BaseBehaviour"> parent="org_alfresco_module_rm_BaseBehaviour">
<property name="dictionaryService" ref="DictionaryService"/> <property name="dictionaryService" ref="DictionaryService"/>
<property name="recordsManagementIdentifierService" ref="recordsManagementIdentifierService"/> <property name="recordsManagementIdentifierService" ref="recordsManagementIdentifierService"/>
<property name="filePlanAuthenticationService" ref="FilePlanAuthenticationService"/>
</bean> </bean>
<bean id="org_alfresco_module_rm_RmSiteType" <bean id="org_alfresco_module_rm_RmSiteType"

View File

@@ -300,12 +300,20 @@ public class RecordsManagementServiceImpl extends ServiceBaseImpl
/** /**
* Called after any Records Management property has been updated. * Called after any Records Management property has been updated.
*/ */
public void onChangeToAnyRmProperty(NodeRef node, Map<QName, Serializable> oldProps, Map<QName, Serializable> newProps) public void onChangeToAnyRmProperty(final NodeRef node, final Map<QName, Serializable> oldProps, final Map<QName, Serializable> newProps)
{ {
if (nodeService.exists(node) == true) serviceRegistry.getFilePlanAuthenticationService().runAsRmAdmin(new RunAsWork<Void>()
{ {
this.lookupAndExecuteScripts(node, oldProps, newProps); @Override
} public Void doWork() throws Exception
{
if (nodeService.exists(node) == true)
{
RecordsManagementServiceImpl.this.lookupAndExecuteScripts(node, oldProps, newProps);
}
return null;
}});
} }
/** /**

View File

@@ -21,6 +21,7 @@ package org.alfresco.module.org_alfresco_module_rm.model.behaviour;
import org.alfresco.model.ContentModel; import org.alfresco.model.ContentModel;
import org.alfresco.module.org_alfresco_module_rm.identifier.IdentifierService; import org.alfresco.module.org_alfresco_module_rm.identifier.IdentifierService;
import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel;
import org.alfresco.module.org_alfresco_module_rm.security.FilePlanAuthenticationService;
import org.alfresco.repo.node.NodeServicePolicies; import org.alfresco.repo.node.NodeServicePolicies;
import org.alfresco.repo.policy.JavaBehaviour; import org.alfresco.repo.policy.JavaBehaviour;
import org.alfresco.repo.policy.PolicyComponent; import org.alfresco.repo.policy.PolicyComponent;
@@ -55,6 +56,9 @@ public class RecordContainerType implements RecordsManagementModel,
/** Identity service */ /** Identity service */
private IdentifierService recordsManagementIdentifierService; private IdentifierService recordsManagementIdentifierService;
/** File plan authentication service */
private FilePlanAuthenticationService filePlanAuthenticationService;
/** /**
* Set the policy component * Set the policy component
* @param policyComponent policy component * @param policyComponent policy component
@@ -84,6 +88,14 @@ public class RecordContainerType implements RecordsManagementModel,
this.dictionaryService = dictionaryService; this.dictionaryService = dictionaryService;
} }
/**
* @param filePlanAuthenticationService file plan authentication service
*/
public void setFilePlanAuthenticationService(FilePlanAuthenticationService filePlanAuthenticationService)
{
this.filePlanAuthenticationService = filePlanAuthenticationService;
}
/** /**
* Set the identity service * Set the identity service
* *
@@ -114,37 +126,46 @@ public class RecordContainerType implements RecordsManagementModel,
* Deal with something created within a record container * Deal with something created within a record container
*/ */
@Override @Override
public void onCreateChildAssociation(ChildAssociationRef childAssocRef, boolean isNewNode) public void onCreateChildAssociation(final ChildAssociationRef childAssocRef, boolean isNewNode)
{ {
// Get the elements of the created association filePlanAuthenticationService.runAsRmAdmin(new RunAsWork<Void>()
final NodeRef child = childAssocRef.getChildRef(); {
QName childType = nodeService.getType(child); @Override
public Void doWork() throws Exception
// We only care about "folder" or sub-types
if (dictionaryService.isSubClass(childType, ContentModel.TYPE_FOLDER) == true)
{
if (dictionaryService.isSubClass(childType, ContentModel.TYPE_SYSTEM_FOLDER) == true)
{ {
// this is a rule container, make sure it is an file plan component // Get the elements of the created association
nodeService.addAspect(child, ASPECT_FILE_PLAN_COMPONENT, null); final NodeRef child = childAssocRef.getChildRef();
} QName childType = nodeService.getType(child);
else
{ // We only care about "folder" or sub-types
// We need to automatically cast the created folder to RM type if it is a plain folder if (dictionaryService.isSubClass(childType, ContentModel.TYPE_FOLDER) == true)
// This occurs if the RM folder has been created via IMap, WebDav, etc {
if (nodeService.hasAspect(child, ASPECT_FILE_PLAN_COMPONENT) == false) if (dictionaryService.isSubClass(childType, ContentModel.TYPE_SYSTEM_FOLDER) == true)
{ {
// TODO it may not always be a record folder ... perhaps if the current user is a admin it would be a record category?? // this is a rule container, make sure it is an file plan component
nodeService.addAspect(child, ASPECT_FILE_PLAN_COMPONENT, null);
// Assume any created folder is a rma:recordFolder }
nodeService.setType(child, TYPE_RECORD_FOLDER); else
} {
// We need to automatically cast the created folder to RM type if it is a plain folder
// This occurs if the RM folder has been created via IMap, WebDav, etc
if (nodeService.hasAspect(child, ASPECT_FILE_PLAN_COMPONENT) == false)
{
// TODO it may not always be a record folder ... perhaps if the current user is a admin it would be a record category??
// Assume any created folder is a rma:recordFolder
nodeService.setType(child, TYPE_RECORD_FOLDER);
}
// Catch all to generate the rm id (assuming it doesn't already have one!) // Catch all to generate the rm id (assuming it doesn't already have one!)
setIdenifierProperty(child); setIdenifierProperty(child);
} }
}
}
return null;
}
});
} }
/** /**

View File

@@ -334,14 +334,23 @@ public class RecordsManagementSearchBehaviour implements RecordsManagementModel
}); });
} }
public void recordFolderCreate(ChildAssociationRef childAssocRef) public void recordFolderCreate(final ChildAssociationRef childAssocRef)
{ {
NodeRef nodeRef = childAssocRef.getChildRef(); AuthenticationUtil.runAsSystem(new AuthenticationUtil.RunAsWork<Void>()
if (nodeService.exists(nodeRef) == true)
{ {
applySearchAspect(nodeRef); @Override
setupDispositionScheduleProperties(nodeRef); public Void doWork() throws Exception
} {
NodeRef nodeRef = childAssocRef.getChildRef();
if (nodeService.exists(nodeRef) == true)
{
applySearchAspect(nodeRef);
setupDispositionScheduleProperties(nodeRef);
}
return null;
}
});
} }
private void setupDispositionScheduleProperties(NodeRef recordOrFolder) private void setupDispositionScheduleProperties(NodeRef recordOrFolder)

View File

@@ -310,14 +310,13 @@ public class RecordsManagementNotificationHelper implements RecordsManagementMod
* *
* @param record rejected record * @param record rejected record
*/ */
public void recordRejectedEmailNotification(NodeRef record, String recordId) public void recordRejectedEmailNotification(NodeRef record, String recordId, String recordCreator)
{ {
ParameterCheck.mandatory("record", record); ParameterCheck.mandatory("record", record);
if (canSendRejectEmail(record) == true) if (canSendRejectEmail(record) == true)
{ {
String site = siteService.getSite(record).getShortName(); String site = siteService.getSite(record).getShortName();
String recordCreator = (String) nodeService.getProperty(record, PROP_RECORD_ORIGINATING_USER_ID);
String rejectReason = (String) nodeService.getProperty(record, PROP_RECORD_REJECTION_REASON); String rejectReason = (String) nodeService.getProperty(record, PROP_RECORD_REJECTION_REASON);
String rejectedPerson = (String) nodeService.getProperty(record, PROP_RECORD_REJECTION_USER_ID); String rejectedPerson = (String) nodeService.getProperty(record, PROP_RECORD_REJECTION_USER_ID);
Date rejectDate = (Date) nodeService.getProperty(record, PROP_RECORD_REJECTION_DATE); Date rejectDate = (Date) nodeService.getProperty(record, PROP_RECORD_REJECTION_DATE);

View File

@@ -573,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, documentOwner);
return null; return null;
} }