mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-31 17:39:05 +00:00
RM-579: Restore the creator of the document when a records manager rejects the record
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/modules/recordsmanagement/HEAD@46374 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -58,6 +58,7 @@ import org.alfresco.service.cmr.security.OwnableService;
|
|||||||
import org.alfresco.service.cmr.security.PermissionService;
|
import org.alfresco.service.cmr.security.PermissionService;
|
||||||
import org.alfresco.service.namespace.QName;
|
import org.alfresco.service.namespace.QName;
|
||||||
import org.alfresco.util.ParameterCheck;
|
import org.alfresco.util.ParameterCheck;
|
||||||
|
import org.apache.commons.lang.StringUtils;
|
||||||
import org.springframework.beans.BeansException;
|
import org.springframework.beans.BeansException;
|
||||||
import org.springframework.context.ApplicationContext;
|
import org.springframework.context.ApplicationContext;
|
||||||
import org.springframework.context.ApplicationContextAware;
|
import org.springframework.context.ApplicationContextAware;
|
||||||
@@ -105,7 +106,7 @@ public class RecordServiceImpl implements RecordService,
|
|||||||
|
|
||||||
/** Policy component */
|
/** Policy component */
|
||||||
private PolicyComponent policyComponent;
|
private PolicyComponent policyComponent;
|
||||||
|
|
||||||
/** Ownable service */
|
/** Ownable service */
|
||||||
private OwnableService ownableService;
|
private OwnableService ownableService;
|
||||||
|
|
||||||
@@ -211,7 +212,7 @@ public class RecordServiceImpl implements RecordService,
|
|||||||
{
|
{
|
||||||
this.ownableService = ownableService;
|
this.ownableService = ownableService;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Init method
|
* Init method
|
||||||
*/
|
*/
|
||||||
@@ -337,11 +338,11 @@ public class RecordServiceImpl implements RecordService,
|
|||||||
// get the documents readers
|
// get the documents readers
|
||||||
Long aclId = nodeService.getNodeAclId(nodeRef);
|
Long aclId = nodeService.getNodeAclId(nodeRef);
|
||||||
Set<String> readers = permissionService.getReaders(aclId);
|
Set<String> readers = permissionService.getReaders(aclId);
|
||||||
Set<String> writers = permissionService.getWriters(aclId);
|
Set<String> writers = permissionService.getWriters(aclId);
|
||||||
|
|
||||||
// add the current owner to the list of extended writers
|
// add the current owner to the list of extended writers
|
||||||
String owner = ownableService.getOwner(nodeRef);
|
String owner = ownableService.getOwner(nodeRef);
|
||||||
|
|
||||||
// remove the owner
|
// remove the owner
|
||||||
ownableService.setOwner(nodeRef, OwnableService.NO_OWNER);
|
ownableService.setOwner(nodeRef, OwnableService.NO_OWNER);
|
||||||
|
|
||||||
@@ -555,6 +556,14 @@ 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
|
||||||
|
String documentOwner = (String) nodeService.getProperty(nodeRef, PROP_RECORD_ORIGINATING_USER_ID);
|
||||||
|
if (StringUtils.isBlank(documentOwner))
|
||||||
|
{
|
||||||
|
throw new AlfrescoRuntimeException("Unable to find the creator of document.");
|
||||||
|
}
|
||||||
|
ownableService.setOwner(nodeRef, documentOwner);
|
||||||
|
|
||||||
// send an email to the record creator
|
// send an email to the record creator
|
||||||
notificationHelper.recordRejectedEmailNotification(nodeRef);
|
notificationHelper.recordRejectedEmailNotification(nodeRef);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user