mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-31 17:39:05 +00:00
RM-1502: on moving a folder to RM: recordSearchDispositionAuthority & recordSearchDispositionInstructions are empty
RM-1521: Failed to Upload New Version if updated rule to Declare as Record is set git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/modules/recordsmanagement/HEAD@75191 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -45,6 +45,7 @@ import org.alfresco.repo.policy.JavaBehaviour;
|
||||
import org.alfresco.repo.policy.PolicyComponent;
|
||||
import org.alfresco.repo.security.authentication.AuthenticationUtil;
|
||||
import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork;
|
||||
import org.alfresco.repo.transaction.TransactionalResourceHelper;
|
||||
import org.alfresco.service.cmr.repository.ChildAssociationRef;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.alfresco.service.cmr.repository.NodeService;
|
||||
@@ -145,11 +146,20 @@ public class RecordsManagementSearchBehaviour implements RecordsManagementModel
|
||||
this.recordService = recordService;
|
||||
}
|
||||
|
||||
/** Java behaviour */
|
||||
/** on add search aspect behaviour */
|
||||
private JavaBehaviour onAddSearchAspect = new JavaBehaviour(this, "rmSearchAspectAdd", NotificationFrequency.TRANSACTION_COMMIT);
|
||||
|
||||
/** disposition action behaviours */
|
||||
private JavaBehaviour jbDispositionActionCreate = new JavaBehaviour(this, "dispositionActionCreate", NotificationFrequency.TRANSACTION_COMMIT);
|
||||
private JavaBehaviour jbDispositionActionPropertiesUpdate = new JavaBehaviour(this, "dispositionActionPropertiesUpdate", NotificationFrequency.TRANSACTION_COMMIT);
|
||||
|
||||
/** disposition lifecycle behaviours */
|
||||
private JavaBehaviour jbDispositionLifeCycleAspect = new JavaBehaviour(this, "onAddDispositionLifecycleAspect", NotificationFrequency.TRANSACTION_COMMIT);
|
||||
|
||||
/** disposition schedule behaviours */
|
||||
private JavaBehaviour jbDispositionSchedulePropertiesUpdate = new JavaBehaviour(this, "dispositionSchedulePropertiesUpdate", NotificationFrequency.TRANSACTION_COMMIT);
|
||||
|
||||
/** event update behaviours */
|
||||
private JavaBehaviour jbEventExecutionUpdate = new JavaBehaviour(this, "eventExecutionUpdate", NotificationFrequency.TRANSACTION_COMMIT);
|
||||
private JavaBehaviour jbEventExecutionDelete = new JavaBehaviour(this, "eventExecutionDelete", NotificationFrequency.TRANSACTION_COMMIT);
|
||||
|
||||
@@ -160,7 +170,8 @@ public class RecordsManagementSearchBehaviour implements RecordsManagementModel
|
||||
jbDispositionActionPropertiesUpdate,
|
||||
jbDispositionSchedulePropertiesUpdate,
|
||||
jbEventExecutionUpdate,
|
||||
jbEventExecutionDelete
|
||||
jbEventExecutionDelete,
|
||||
jbDispositionLifeCycleAspect
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -198,6 +209,11 @@ public class RecordsManagementSearchBehaviour implements RecordsManagementModel
|
||||
QName.createQName(NamespaceService.ALFRESCO_URI, "onAddAspect"),
|
||||
ASPECT_RM_SEARCH,
|
||||
onAddSearchAspect);
|
||||
|
||||
this.policyComponent.bindClassBehaviour(
|
||||
QName.createQName(NamespaceService.ALFRESCO_URI, "onAddAspect"),
|
||||
ASPECT_DISPOSITION_LIFECYCLE,
|
||||
jbDispositionLifeCycleAspect);
|
||||
|
||||
this.policyComponent.bindClassBehaviour(
|
||||
QName.createQName(NamespaceService.ALFRESCO_URI, "onAddAspect"),
|
||||
@@ -355,7 +371,30 @@ public class RecordsManagementSearchBehaviour implements RecordsManagementModel
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* On addition of the disposition lifecycle aspect
|
||||
* @param nodeRef
|
||||
* @param aspectTypeQName
|
||||
*/
|
||||
public void onAddDispositionLifecycleAspect(final NodeRef nodeRef, final QName aspectTypeQName)
|
||||
{
|
||||
AuthenticationUtil.runAsSystem(new AuthenticationUtil.RunAsWork<Void>()
|
||||
{
|
||||
@Override
|
||||
public Void doWork()
|
||||
{
|
||||
if (nodeService.exists(nodeRef) && nodeService.hasAspect(nodeRef, ASPECT_RECORD))
|
||||
{
|
||||
applySearchAspect(nodeRef);
|
||||
setupDispositionScheduleProperties(nodeRef);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* On create record folder behaviour implmentation
|
||||
*
|
||||
@@ -387,21 +426,24 @@ public class RecordsManagementSearchBehaviour implements RecordsManagementModel
|
||||
*/
|
||||
private void setupDispositionScheduleProperties(NodeRef recordOrFolder)
|
||||
{
|
||||
DispositionSchedule ds = dispositionService.getDispositionSchedule(recordOrFolder);
|
||||
if (ds == null)
|
||||
{
|
||||
nodeService.setProperty(recordOrFolder, PROP_RS_HAS_DISPOITION_SCHEDULE, false);
|
||||
}
|
||||
else
|
||||
{
|
||||
nodeService.setProperty(recordOrFolder, PROP_RS_HAS_DISPOITION_SCHEDULE, true);
|
||||
setDispositionScheduleProperties(recordOrFolder, ds);
|
||||
}
|
||||
|
||||
if (logger.isDebugEnabled())
|
||||
{
|
||||
logger.debug("Set rma:recordSearchHasDispositionSchedule for node " + recordOrFolder +
|
||||
" to: " + (ds != null));
|
||||
if (!methodCached("setupDispositionScheduleProperties", recordOrFolder))
|
||||
{
|
||||
DispositionSchedule ds = dispositionService.getDispositionSchedule(recordOrFolder);
|
||||
if (ds == null)
|
||||
{
|
||||
nodeService.setProperty(recordOrFolder, PROP_RS_HAS_DISPOITION_SCHEDULE, false);
|
||||
}
|
||||
else
|
||||
{
|
||||
nodeService.setProperty(recordOrFolder, PROP_RS_HAS_DISPOITION_SCHEDULE, true);
|
||||
setDispositionScheduleProperties(recordOrFolder, ds);
|
||||
}
|
||||
|
||||
if (logger.isDebugEnabled())
|
||||
{
|
||||
logger.debug("Set rma:recordSearchHasDispositionSchedule for node " + recordOrFolder +
|
||||
" to: " + (ds != null));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -429,6 +471,28 @@ public class RecordsManagementSearchBehaviour implements RecordsManagementModel
|
||||
nodeService.setProperty(record, PROP_RS_DISPOSITION_EVENTS, null);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper method to determine whether a method has been called in this transaction
|
||||
* already, or not.
|
||||
* <P>
|
||||
* Prevents work if we get unexpected behaviours firing.
|
||||
*
|
||||
* @param method method name (can be any unique string)
|
||||
* @return boolean true if already called in this transaction, false otherwise
|
||||
*/
|
||||
private boolean methodCached(String method, NodeRef nodeRef)
|
||||
{
|
||||
boolean result = true;
|
||||
Set<String> methods = TransactionalResourceHelper.getSet("rm.seachrollup.methodCache");
|
||||
String key = method + "|" + nodeRef;
|
||||
if (!methods.contains(key))
|
||||
{
|
||||
result = false;
|
||||
methods.add(key);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* On update disposition action properties behaviour implementation
|
||||
@@ -438,45 +502,48 @@ public class RecordsManagementSearchBehaviour implements RecordsManagementModel
|
||||
*/
|
||||
private void updateDispositionActionProperties(NodeRef record, NodeRef dispositionAction)
|
||||
{
|
||||
Map<QName, Serializable> props = nodeService.getProperties(record);
|
||||
|
||||
DispositionAction da = new DispositionActionImpl(recordsManagementServiceRegistry, dispositionAction);
|
||||
|
||||
props.put(PROP_RS_DISPOSITION_ACTION_NAME, da.getName());
|
||||
props.put(PROP_RS_DISPOSITION_ACTION_AS_OF, da.getAsOfDate());
|
||||
props.put(PROP_RS_DISPOSITION_EVENTS_ELIGIBLE, nodeService.getProperty(dispositionAction, PROP_DISPOSITION_EVENTS_ELIGIBLE));
|
||||
|
||||
DispositionActionDefinition daDefinition = da.getDispositionActionDefinition();
|
||||
if (daDefinition != null)
|
||||
if (!methodCached("updateDispositionActionProperties", record))
|
||||
{
|
||||
Period period = daDefinition.getPeriod();
|
||||
if (period != null)
|
||||
Map<QName, Serializable> props = nodeService.getProperties(record);
|
||||
|
||||
DispositionAction da = new DispositionActionImpl(recordsManagementServiceRegistry, dispositionAction);
|
||||
|
||||
props.put(PROP_RS_DISPOSITION_ACTION_NAME, da.getName());
|
||||
props.put(PROP_RS_DISPOSITION_ACTION_AS_OF, da.getAsOfDate());
|
||||
props.put(PROP_RS_DISPOSITION_EVENTS_ELIGIBLE, nodeService.getProperty(dispositionAction, PROP_DISPOSITION_EVENTS_ELIGIBLE));
|
||||
|
||||
DispositionActionDefinition daDefinition = da.getDispositionActionDefinition();
|
||||
if (daDefinition != null)
|
||||
{
|
||||
props.put(PROP_RS_DISPOSITION_PERIOD, period.getPeriodType());
|
||||
props.put(PROP_RS_DISPOSITION_PERIOD_EXPRESSION, period.getExpression());
|
||||
Period period = daDefinition.getPeriod();
|
||||
if (period != null)
|
||||
{
|
||||
props.put(PROP_RS_DISPOSITION_PERIOD, period.getPeriodType());
|
||||
props.put(PROP_RS_DISPOSITION_PERIOD_EXPRESSION, period.getExpression());
|
||||
}
|
||||
else
|
||||
{
|
||||
props.put(PROP_RS_DISPOSITION_PERIOD, null);
|
||||
props.put(PROP_RS_DISPOSITION_PERIOD_EXPRESSION, null);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
nodeService.setProperties(record, props);
|
||||
|
||||
if (logger.isDebugEnabled())
|
||||
{
|
||||
props.put(PROP_RS_DISPOSITION_PERIOD, null);
|
||||
props.put(PROP_RS_DISPOSITION_PERIOD_EXPRESSION, null);
|
||||
logger.debug("Set rma:recordSearchDispositionActionName for node " + record + " to: " +
|
||||
props.get(PROP_RS_DISPOSITION_ACTION_NAME));
|
||||
logger.debug("Set rma:recordSearchDispositionActionAsOf for node " + record + " to: " +
|
||||
props.get(PROP_RS_DISPOSITION_ACTION_AS_OF));
|
||||
logger.debug("Set rma:recordSearchDispositionEventsEligible for node " + record + " to: " +
|
||||
props.get(PROP_RS_DISPOSITION_EVENTS_ELIGIBLE));
|
||||
logger.debug("Set rma:recordSearchDispositionPeriod for node " + record + " to: " +
|
||||
props.get(PROP_RS_DISPOSITION_PERIOD));
|
||||
logger.debug("Set rma:recordSearchDispositionPeriodExpression for node " + record + " to: " +
|
||||
props.get(PROP_RS_DISPOSITION_PERIOD_EXPRESSION));
|
||||
}
|
||||
}
|
||||
|
||||
nodeService.setProperties(record, props);
|
||||
|
||||
if (logger.isDebugEnabled())
|
||||
{
|
||||
logger.debug("Set rma:recordSearchDispositionActionName for node " + record + " to: " +
|
||||
props.get(PROP_RS_DISPOSITION_ACTION_NAME));
|
||||
logger.debug("Set rma:recordSearchDispositionActionAsOf for node " + record + " to: " +
|
||||
props.get(PROP_RS_DISPOSITION_ACTION_AS_OF));
|
||||
logger.debug("Set rma:recordSearchDispositionEventsEligible for node " + record + " to: " +
|
||||
props.get(PROP_RS_DISPOSITION_EVENTS_ELIGIBLE));
|
||||
logger.debug("Set rma:recordSearchDispositionPeriod for node " + record + " to: " +
|
||||
props.get(PROP_RS_DISPOSITION_PERIOD));
|
||||
logger.debug("Set rma:recordSearchDispositionPeriodExpression for node " + record + " to: " +
|
||||
props.get(PROP_RS_DISPOSITION_PERIOD_EXPRESSION));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -549,25 +616,28 @@ public class RecordsManagementSearchBehaviour implements RecordsManagementModel
|
||||
*/
|
||||
private void setupDispositionActionEvents(NodeRef nodeRef, DispositionAction da)
|
||||
{
|
||||
if (da != null)
|
||||
if (!methodCached("setupDispositionActionEvents", nodeRef))
|
||||
{
|
||||
List<String> eventNames = null;
|
||||
List<EventCompletionDetails> eventsList = da.getEventCompletionDetails();
|
||||
if (eventsList.size() > 0)
|
||||
if (da != null)
|
||||
{
|
||||
eventNames = new ArrayList<String>(eventsList.size());
|
||||
for (EventCompletionDetails event : eventsList)
|
||||
List<String> eventNames = null;
|
||||
List<EventCompletionDetails> eventsList = da.getEventCompletionDetails();
|
||||
if (eventsList.size() > 0)
|
||||
{
|
||||
eventNames.add(event.getEventName());
|
||||
eventNames = new ArrayList<String>(eventsList.size());
|
||||
for (EventCompletionDetails event : eventsList)
|
||||
{
|
||||
eventNames.add(event.getEventName());
|
||||
}
|
||||
}
|
||||
|
||||
// set the property
|
||||
nodeService.setProperty(nodeRef, PROP_RS_DISPOSITION_EVENTS, (Serializable)eventNames);
|
||||
|
||||
if (logger.isDebugEnabled())
|
||||
{
|
||||
logger.debug("Set rma:recordSearchDispositionEvents for node " + nodeRef + " to: " + eventNames);
|
||||
}
|
||||
}
|
||||
|
||||
// set the property
|
||||
nodeService.setProperty(nodeRef, PROP_RS_DISPOSITION_EVENTS, (Serializable)eventNames);
|
||||
|
||||
if (logger.isDebugEnabled())
|
||||
{
|
||||
logger.debug("Set rma:recordSearchDispositionEvents for node " + nodeRef + " to: " + eventNames);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -659,18 +729,21 @@ public class RecordsManagementSearchBehaviour implements RecordsManagementModel
|
||||
*/
|
||||
private void updateVitalRecordDefinitionValues(NodeRef nodeRef)
|
||||
{
|
||||
// ensure the folder itself reflects the correct details
|
||||
applySearchAspect(nodeRef);
|
||||
setVitalRecordDefintionDetails(nodeRef);
|
||||
|
||||
List<NodeRef> records = recordService.getRecords(nodeRef);
|
||||
for (NodeRef record : records)
|
||||
if (!methodCached("updateVitalRecordDefinitionValues", nodeRef))
|
||||
{
|
||||
// Apply the search aspect
|
||||
applySearchAspect(record);
|
||||
|
||||
// Set the vital record definition details
|
||||
setVitalRecordDefintionDetails(record);
|
||||
// ensure the folder itself reflects the correct details
|
||||
applySearchAspect(nodeRef);
|
||||
setVitalRecordDefintionDetails(nodeRef);
|
||||
|
||||
List<NodeRef> records = recordService.getRecords(nodeRef);
|
||||
for (NodeRef record : records)
|
||||
{
|
||||
// Apply the search aspect
|
||||
applySearchAspect(record);
|
||||
|
||||
// Set the vital record definition details
|
||||
setVitalRecordDefintionDetails(record);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -681,27 +754,30 @@ public class RecordsManagementSearchBehaviour implements RecordsManagementModel
|
||||
*/
|
||||
private void setVitalRecordDefintionDetails(NodeRef nodeRef)
|
||||
{
|
||||
VitalRecordDefinition vrd = vitalRecordService.getVitalRecordDefinition(nodeRef);
|
||||
|
||||
if (vrd != null && vrd.isEnabled() && vrd.getReviewPeriod() != null)
|
||||
if (!methodCached("setVitalRecordDefinitionDetails", nodeRef))
|
||||
{
|
||||
// Set the property values
|
||||
nodeService.setProperty(nodeRef, PROP_RS_VITAL_RECORD_REVIEW_PERIOD, vrd.getReviewPeriod().getPeriodType());
|
||||
nodeService.setProperty(nodeRef, PROP_RS_VITAL_RECORD_REVIEW_PERIOD_EXPRESSION, vrd.getReviewPeriod().getExpression());
|
||||
|
||||
if (logger.isDebugEnabled())
|
||||
VitalRecordDefinition vrd = vitalRecordService.getVitalRecordDefinition(nodeRef);
|
||||
|
||||
if (vrd != null && vrd.isEnabled() && vrd.getReviewPeriod() != null)
|
||||
{
|
||||
logger.debug("Set rma:recordSearchVitalRecordReviewPeriod for node " + nodeRef + " to: " +
|
||||
vrd.getReviewPeriod().getPeriodType());
|
||||
logger.debug("Set rma:recordSearchVitalRecordReviewPeriodExpression for node " + nodeRef + " to: " +
|
||||
vrd.getReviewPeriod().getExpression());
|
||||
// Set the property values
|
||||
nodeService.setProperty(nodeRef, PROP_RS_VITAL_RECORD_REVIEW_PERIOD, vrd.getReviewPeriod().getPeriodType());
|
||||
nodeService.setProperty(nodeRef, PROP_RS_VITAL_RECORD_REVIEW_PERIOD_EXPRESSION, vrd.getReviewPeriod().getExpression());
|
||||
|
||||
if (logger.isDebugEnabled())
|
||||
{
|
||||
logger.debug("Set rma:recordSearchVitalRecordReviewPeriod for node " + nodeRef + " to: " +
|
||||
vrd.getReviewPeriod().getPeriodType());
|
||||
logger.debug("Set rma:recordSearchVitalRecordReviewPeriodExpression for node " + nodeRef + " to: " +
|
||||
vrd.getReviewPeriod().getExpression());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Clear the vital record properties
|
||||
nodeService.setProperty(nodeRef, PROP_RS_VITAL_RECORD_REVIEW_PERIOD, null);
|
||||
nodeService.setProperty(nodeRef, PROP_RS_VITAL_RECORD_REVIEW_PERIOD_EXPRESSION, null);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Clear the vital record properties
|
||||
nodeService.setProperty(nodeRef, PROP_RS_VITAL_RECORD_REVIEW_PERIOD, null);
|
||||
nodeService.setProperty(nodeRef, PROP_RS_VITAL_RECORD_REVIEW_PERIOD_EXPRESSION, null);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -228,7 +228,8 @@ public class RecordAspect extends AbstractDisposableItem
|
||||
public void onMoveNode(ChildAssociationRef oldChildAssocRef, ChildAssociationRef newChildAssocRef)
|
||||
{
|
||||
// check the records parent has actually changed
|
||||
if (!oldChildAssocRef.getParentRef().equals(newChildAssocRef.getParentRef()))
|
||||
if (!oldChildAssocRef.getParentRef().equals(newChildAssocRef.getParentRef()) &&
|
||||
isFilePlanComponent(oldChildAssocRef.getParentRef()))
|
||||
{
|
||||
final NodeRef record = newChildAssocRef.getChildRef();
|
||||
AuthenticationUtil.runAs(new AuthenticationUtil.RunAsWork<Object>()
|
||||
|
@@ -21,7 +21,6 @@ package org.alfresco.repo.rule;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import org.alfresco.model.ContentModel;
|
||||
import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService;
|
||||
import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel;
|
||||
import org.alfresco.module.org_alfresco_module_rm.record.RecordService;
|
||||
@@ -158,40 +157,42 @@ public class ExtendedRuleServiceImpl extends RuleServiceImpl
|
||||
@Override
|
||||
public void executeRule(final Rule rule, final NodeRef nodeRef, final Set<ExecutedRuleData> executedRules)
|
||||
{
|
||||
QName typeQName = nodeService.getType(nodeRef);
|
||||
|
||||
if (nodeService.exists(nodeRef) && shouldRuleBeAppliedToNode(rule, nodeRef, typeQName))
|
||||
if (nodeService.exists(nodeRef))
|
||||
{
|
||||
// check if this is a rm rule on a rm artifact
|
||||
if (filePlanService.isFilePlanComponent(nodeRef) &&
|
||||
isFilePlanComponentRule(rule))
|
||||
QName typeQName = nodeService.getType(nodeRef);
|
||||
if (shouldRuleBeAppliedToNode(rule, nodeRef, typeQName))
|
||||
{
|
||||
// ignore and
|
||||
if (!isIgnoredType(typeQName))
|
||||
{
|
||||
if (runAsAdmin)
|
||||
{
|
||||
AuthenticationUtil.runAs(new RunAsWork<Void>()
|
||||
{
|
||||
@Override
|
||||
public Void doWork()
|
||||
// check if this is a rm rule on a rm artifact
|
||||
if (filePlanService.isFilePlanComponent(nodeRef) &&
|
||||
isFilePlanComponentRule(rule))
|
||||
{
|
||||
// ignore and
|
||||
if (!isIgnoredType(typeQName))
|
||||
{
|
||||
if (runAsAdmin)
|
||||
{
|
||||
AuthenticationUtil.runAs(new RunAsWork<Void>()
|
||||
{
|
||||
ExtendedRuleServiceImpl.super.executeRule(rule, nodeRef, executedRules);
|
||||
return null;
|
||||
}
|
||||
}, AuthenticationUtil.getAdminUserName());
|
||||
}
|
||||
else
|
||||
{
|
||||
// run as current user
|
||||
ExtendedRuleServiceImpl.super.executeRule(rule, nodeRef, executedRules);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// just execute the rule as the current user
|
||||
super.executeRule(rule, nodeRef, executedRules);
|
||||
@Override
|
||||
public Void doWork()
|
||||
{
|
||||
ExtendedRuleServiceImpl.super.executeRule(rule, nodeRef, executedRules);
|
||||
return null;
|
||||
}
|
||||
}, AuthenticationUtil.getAdminUserName());
|
||||
}
|
||||
else
|
||||
{
|
||||
// run as current user
|
||||
ExtendedRuleServiceImpl.super.executeRule(rule, nodeRef, executedRules);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// just execute the rule as the current user
|
||||
super.executeRule(rule, nodeRef, executedRules);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -243,7 +244,7 @@ public class ExtendedRuleServiceImpl extends RuleServiceImpl
|
||||
RecordsManagementModel.TYPE_UNFILED_RECORD_FOLDER.equals(typeQName) ||
|
||||
nodeService.hasAspect(nodeRef, RecordsManagementModel.ASPECT_TRANSFERRING) ||
|
||||
nodeService.hasAspect(nodeRef, RecordsManagementModel.ASPECT_FROZEN) ||
|
||||
(ContentModel.TYPE_CONTENT.equals(typeQName) && !recordService.isFiled(nodeRef)));
|
||||
!recordService.isFiled(nodeRef));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
@@ -43,6 +43,12 @@ public class MoveRecordTest extends BaseRMTestCase
|
||||
{
|
||||
private static final String OTHER_EVENT = "abolished";
|
||||
|
||||
@Override
|
||||
protected boolean isCollaborationSiteTest()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Given a record is filed in a event disposition and moved then the
|
||||
* record no longer has any disposition.
|
||||
@@ -183,7 +189,10 @@ public class MoveRecordTest extends BaseRMTestCase
|
||||
assertTrue(nodeService.hasAspect(record, ASPECT_RM_SEARCH));
|
||||
assertEquals(CutOffAction.NAME, nodeService.getProperty(record, PROP_RS_DISPOSITION_ACTION_NAME));
|
||||
assertNull(nodeService.getProperty(record, PROP_RS_DISPOSITION_ACTION_AS_OF));
|
||||
assertTrue(((List<String>)nodeService.getProperty(record, PROP_RS_DISPOSITION_EVENTS)).contains(OTHER_EVENT));
|
||||
assertTrue(((List<String>)nodeService.getProperty(record, PROP_RS_DISPOSITION_EVENTS)).contains(OTHER_EVENT));
|
||||
assertNotNull(nodeService.getProperty(record, PROP_RS_DISPOITION_INSTRUCTIONS));
|
||||
assertNotNull(nodeService.getProperty(record, PROP_RS_DISPOITION_AUTHORITY));
|
||||
assertTrue((Boolean)nodeService.getProperty(record, PROP_RS_HAS_DISPOITION_SCHEDULE));
|
||||
}
|
||||
});
|
||||
|
||||
@@ -265,14 +274,68 @@ public class MoveRecordTest extends BaseRMTestCase
|
||||
assertTrue(nodeService.hasAspect(record, ASPECT_RM_SEARCH));
|
||||
assertEquals(CutOffAction.NAME, nodeService.getProperty(record, PROP_RS_DISPOSITION_ACTION_NAME));
|
||||
assertNotNull(nodeService.getProperty(record, PROP_RS_DISPOSITION_ACTION_AS_OF));
|
||||
assertNull(((List<String>)nodeService.getProperty(record, PROP_RS_DISPOSITION_EVENTS)));
|
||||
}
|
||||
});
|
||||
|
||||
assertNull(((List<String>)nodeService.getProperty(record, PROP_RS_DISPOSITION_EVENTS)));
|
||||
assertNotNull(nodeService.getProperty(record, PROP_RS_DISPOITION_INSTRUCTIONS));
|
||||
assertNotNull(nodeService.getProperty(record, PROP_RS_DISPOITION_AUTHORITY));
|
||||
assertTrue((Boolean)nodeService.getProperty(record, PROP_RS_HAS_DISPOITION_SCHEDULE));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// TODO moveRecordNoDisToEventDis
|
||||
/**
|
||||
* See https://issues.alfresco.com/jira/browse/RM-1502
|
||||
*/
|
||||
public void testMoveDMtoRM()
|
||||
{
|
||||
doBehaviourDrivenTest(new BehaviourDrivenTest()
|
||||
{
|
||||
NodeRef destinationCategory;
|
||||
NodeRef destinationRecordFolder;
|
||||
|
||||
public void given()
|
||||
{
|
||||
// destination category
|
||||
destinationCategory = filePlanService.createRecordCategory(filePlan, GUID.generate());
|
||||
DispositionSchedule dis = utils.createBasicDispositionSchedule(destinationCategory, GUID.generate(), GUID.generate(), true, false);
|
||||
Map<QName, Serializable> adParams = new HashMap<QName, Serializable>(3);
|
||||
adParams.put(PROP_DISPOSITION_ACTION_NAME, CutOffAction.NAME);
|
||||
adParams.put(PROP_DISPOSITION_DESCRIPTION, GUID.generate());
|
||||
adParams.put(PROP_DISPOSITION_PERIOD, CommonRMTestUtils.PERIOD_IMMEDIATELY);
|
||||
dispositionService.addDispositionActionDefinition(dis, adParams);
|
||||
destinationRecordFolder = recordFolderService.createRecordFolder(destinationCategory, GUID.generate());
|
||||
}
|
||||
|
||||
public void when() throws Exception
|
||||
{
|
||||
// move document to record folder
|
||||
fileFolderService.move(dmDocument, destinationRecordFolder, null);
|
||||
}
|
||||
|
||||
public void then()
|
||||
{
|
||||
// check for the lifecycle aspect
|
||||
assertTrue(nodeService.hasAspect(dmDocument, ASPECT_DISPOSITION_LIFECYCLE));
|
||||
|
||||
// check the disposition action details
|
||||
DispositionAction dispositionAction = dispositionService.getNextDispositionAction(dmDocument);
|
||||
assertNotNull(dispositionAction);
|
||||
assertNotNull(CutOffAction.NAME, dispositionAction.getName());
|
||||
assertNotNull(dispositionAction.getAsOfDate());
|
||||
assertTrue(dispositionService.isNextDispositionActionEligible(dmDocument));
|
||||
assertNull(dispositionAction.getEventCompletionDetails(CommonRMTestUtils.DEFAULT_EVENT_NAME));
|
||||
|
||||
// check the search aspect details
|
||||
assertTrue(nodeService.hasAspect(dmDocument, ASPECT_RM_SEARCH));
|
||||
assertEquals(CutOffAction.NAME, nodeService.getProperty(dmDocument, PROP_RS_DISPOSITION_ACTION_NAME));
|
||||
assertNotNull(nodeService.getProperty(dmDocument, PROP_RS_DISPOSITION_ACTION_AS_OF));
|
||||
assertNull(((List<String>)nodeService.getProperty(dmDocument, PROP_RS_DISPOSITION_EVENTS)));
|
||||
assertNotNull(nodeService.getProperty(dmDocument, PROP_RS_DISPOITION_INSTRUCTIONS));
|
||||
assertNotNull(nodeService.getProperty(dmDocument, PROP_RS_DISPOITION_AUTHORITY));
|
||||
assertTrue((Boolean)nodeService.getProperty(dmDocument, PROP_RS_HAS_DISPOITION_SCHEDULE));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// TODO moveRecordNoDisToEventDis
|
||||
// TODO moveRecordRecordDisToFolderDis
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user