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

@@ -300,12 +300,20 @@ public class RecordsManagementServiceImpl extends ServiceBaseImpl
/**
* 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.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.security.FilePlanAuthenticationService;
import org.alfresco.repo.node.NodeServicePolicies;
import org.alfresco.repo.policy.JavaBehaviour;
import org.alfresco.repo.policy.PolicyComponent;
@@ -55,6 +56,9 @@ public class RecordContainerType implements RecordsManagementModel,
/** Identity service */
private IdentifierService recordsManagementIdentifierService;
/** File plan authentication service */
private FilePlanAuthenticationService filePlanAuthenticationService;
/**
* Set the policy component
* @param policyComponent policy component
@@ -84,6 +88,14 @@ public class RecordContainerType implements RecordsManagementModel,
this.dictionaryService = dictionaryService;
}
/**
* @param filePlanAuthenticationService file plan authentication service
*/
public void setFilePlanAuthenticationService(FilePlanAuthenticationService filePlanAuthenticationService)
{
this.filePlanAuthenticationService = filePlanAuthenticationService;
}
/**
* Set the identity service
*
@@ -114,37 +126,46 @@ public class RecordContainerType implements RecordsManagementModel,
* Deal with something created within a record container
*/
@Override
public void onCreateChildAssociation(ChildAssociationRef childAssocRef, boolean isNewNode)
public void onCreateChildAssociation(final ChildAssociationRef childAssocRef, boolean isNewNode)
{
// Get the elements of the created association
final NodeRef child = childAssocRef.getChildRef();
QName childType = nodeService.getType(child);
// 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)
filePlanAuthenticationService.runAsRmAdmin(new RunAsWork<Void>()
{
@Override
public Void doWork() throws Exception
{
// this is a rule container, make sure it is an file plan component
nodeService.addAspect(child, ASPECT_FILE_PLAN_COMPONENT, null);
}
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);
}
// Get the elements of the created association
final NodeRef child = childAssocRef.getChildRef();
QName childType = nodeService.getType(child);
// 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
nodeService.addAspect(child, ASPECT_FILE_PLAN_COMPONENT, null);
}
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!)
setIdenifierProperty(child);
}
}
// Catch all to generate the rm id (assuming it doesn't already have one!)
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();
if (nodeService.exists(nodeRef) == true)
AuthenticationUtil.runAsSystem(new AuthenticationUtil.RunAsWork<Void>()
{
applySearchAspect(nodeRef);
setupDispositionScheduleProperties(nodeRef);
}
@Override
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)

View File

@@ -310,14 +310,13 @@ public class RecordsManagementNotificationHelper implements RecordsManagementMod
*
* @param record rejected record
*/
public void recordRejectedEmailNotification(NodeRef record, String recordId)
public void recordRejectedEmailNotification(NodeRef record, String recordId, String recordCreator)
{
ParameterCheck.mandatory("record", record);
if (canSendRejectEmail(record) == true)
{
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 rejectedPerson = (String) nodeService.getProperty(record, PROP_RECORD_REJECTION_USER_ID);
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);
// send an email to the record creator
notificationHelper.recordRejectedEmailNotification(nodeRef, recordId);
notificationHelper.recordRejectedEmailNotification(nodeRef, recordId, documentOwner);
return null;
}