mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-31 17:39:05 +00:00
Merge branch 'release/V2.5' into merge/MergeV25ToMaster_111016
This commit is contained in:
@@ -86,3 +86,10 @@ rm.patch.v22.convertToStandardFilePlan=false
|
||||
# a document will be auto-versioned when its type is changed.
|
||||
#
|
||||
version.store.enableAutoVersionOnTypeChange=false
|
||||
|
||||
#
|
||||
# Enable auto-version to be created when there is a difference between the document and latest record state
|
||||
# to ensure that the created version record matches the current document state,
|
||||
# otherwise create the version record from the version history
|
||||
#
|
||||
rm.enableAutoVersionOnRecordCreation=false
|
||||
|
@@ -19,3 +19,4 @@ rm.service.close-record-folder-not-folder=The record folder couldn't be closed b
|
||||
rm.service.node-has-aspect=The record type {1} is already showing for record {0}.
|
||||
rm.service.final-version=Final
|
||||
rm.service.final-version-description=The final archived record version
|
||||
rm.service.enable-autoversion-on-record-creation=Auto Version on Record Creation
|
@@ -154,6 +154,7 @@
|
||||
org.alfresco.module.org_alfresco_module_rm.disposition.DispositionService.getLastCompletedDispostionAction=RM.Read.0
|
||||
org.alfresco.module.org_alfresco_module_rm.disposition.DispositionService.isDisposableItemCutoff=RM.Read.0
|
||||
org.alfresco.module.org_alfresco_module_rm.disposition.DispositionService.cutoffDisposableItem=RM.Read.0
|
||||
org.alfresco.module.org_alfresco_module_rm.disposition.DispositionService.calculateAsOfDate=RM_ALLOW
|
||||
org.alfresco.module.org_alfresco_module_rm.disposition.DispositionService.*=RM_DENY
|
||||
]]>
|
||||
</value>
|
||||
|
@@ -21,6 +21,7 @@
|
||||
<!-- extended version service bean definition -->
|
||||
<bean id="rm.versionService" abstract="true" class="org.alfresco.module.org_alfresco_module_rm.version.RecordableVersionServiceImpl">
|
||||
<property name="filePlanService" ref="FilePlanService" />
|
||||
<property name="enableAutoVersionOnRecordCreation" value="${rm.enableAutoVersionOnRecordCreation}" />
|
||||
<property name="authenticationUtil" ref="rm.authenticationUtil" />
|
||||
<property name="relationshipService" ref="RelationshipService" />
|
||||
<property name="recordService" ref="RecordService" />
|
||||
@@ -77,6 +78,7 @@
|
||||
<value>
|
||||
<![CDATA[
|
||||
org.alfresco.module.org_alfresco_module_rm.version.RecordableVersionService.isCurrentVersionRecorded=RM_ALLOW
|
||||
org.alfresco.module.org_alfresco_module_rm.version.RecordableVersionService.isEnableAutoVersionOnRecordCreation=RM_ALLOW
|
||||
org.alfresco.module.org_alfresco_module_rm.version.RecordableVersionService.isRecordedVersion=RM_ALLOW
|
||||
org.alfresco.module.org_alfresco_module_rm.version.RecordableVersionService.getVersionRecord=RM_ALLOW
|
||||
org.alfresco.module.org_alfresco_module_rm.version.RecordableVersionService.getRecordedVersion=RM_ALLOW
|
||||
|
@@ -246,17 +246,11 @@ public class BroadcastDispositionActionDefinitionUpdateAction extends RMActionEx
|
||||
* @param dispositionActionDef The disposition action definition node
|
||||
* @param nextAction The next disposition action
|
||||
*/
|
||||
private void persistPeriodChanges(NodeRef dispositionActionDef, DispositionAction nextAction)
|
||||
protected void persistPeriodChanges(NodeRef dispositionActionDef, DispositionAction nextAction)
|
||||
{
|
||||
Date newAsOfDate = null;
|
||||
Period dispositionPeriod = (Period) getNodeService().getProperty(dispositionActionDef, PROP_DISPOSITION_PERIOD);
|
||||
|
||||
if (dispositionPeriod != null)
|
||||
{
|
||||
// calculate the new as of date as we have been provided a new period
|
||||
Date now = new Date();
|
||||
newAsOfDate = dispositionPeriod.getNextDate(now);
|
||||
}
|
||||
NodeRef dispositionedNode = getNodeService().getPrimaryParent(nextAction.getNodeRef()).getParentRef();
|
||||
DispositionActionDefinition definition = nextAction.getDispositionActionDefinition();
|
||||
Date newAsOfDate = getDispositionService().calculateAsOfDate(dispositionedNode, definition, false);
|
||||
|
||||
if (logger.isDebugEnabled())
|
||||
{
|
||||
|
@@ -181,12 +181,12 @@ public class DestroyAction extends RMDispositionActionExecuterAbstractBase
|
||||
recordableVersionService.destroyRecordedVersion(version);
|
||||
}
|
||||
|
||||
// Add the ghosted aspect
|
||||
getNodeService().addAspect(record, ASPECT_GHOSTED, null);
|
||||
|
||||
// Hide from inplace users to give the impression of destruction
|
||||
inplaceRecordService.hideRecord(record);
|
||||
|
||||
// Add the ghosted aspect
|
||||
getNodeService().addAspect(record, ASPECT_GHOSTED, null);
|
||||
|
||||
// destroy content
|
||||
contentDestructionComponent.destroyContent(record);
|
||||
}
|
||||
|
@@ -29,6 +29,7 @@ package org.alfresco.module.org_alfresco_module_rm.disposition;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Collection;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@@ -242,4 +243,15 @@ public interface DispositionService
|
||||
* @param nodeRef node reference
|
||||
*/
|
||||
void refreshDispositionAction(NodeRef nodeRef);
|
||||
|
||||
/**
|
||||
* Compute the "disposition as of" date (if necessary) for a disposition action and a node.
|
||||
*
|
||||
* @param nodeRef The node which the schedule applies to.
|
||||
* @param dispositionActionDefinition The definition of the disposition action.
|
||||
* @param allowContextFromAsOf true if the context date is allowed to be obtained from the disposition "as of" property.
|
||||
* @return The new "disposition as of" date.
|
||||
*/
|
||||
Date calculateAsOfDate(NodeRef nodeRef, DispositionActionDefinition dispositionActionDefinition,
|
||||
boolean allowContextFromAsOf);
|
||||
}
|
||||
|
@@ -62,8 +62,8 @@ import org.alfresco.service.namespace.NamespaceService;
|
||||
import org.alfresco.service.namespace.QName;
|
||||
import org.alfresco.service.namespace.RegexQNamePattern;
|
||||
import org.alfresco.util.ParameterCheck;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
* Disposition service implementation.
|
||||
@@ -77,7 +77,7 @@ public class DispositionServiceImpl extends ServiceBaseImpl
|
||||
RecordsManagementPolicies.OnFileRecord
|
||||
{
|
||||
/** Logger */
|
||||
private static Log logger = LogFactory.getLog(DispositionServiceImpl.class);
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(DispositionServiceImpl.class);
|
||||
|
||||
/** Behaviour filter */
|
||||
private BehaviourFilter behaviourFilter;
|
||||
@@ -226,7 +226,7 @@ public class DispositionServiceImpl extends ServiceBaseImpl
|
||||
DispositionActionDefinition nextDispositionActionDefinition = dispositionActionDefinitions.get(0);
|
||||
|
||||
// initialise the details of the next disposition action
|
||||
initialiseDispositionAction(nodeRef, nextDispositionActionDefinition);
|
||||
initialiseDispositionAction(nodeRef, nextDispositionActionDefinition, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -396,11 +396,11 @@ public class DispositionServiceImpl extends ServiceBaseImpl
|
||||
{
|
||||
// TODO in the future we should be able to support disposition schedule reuse, but for now just warn that
|
||||
// only the first disposition schedule will be considered
|
||||
if (logger.isWarnEnabled())
|
||||
if (LOGGER.isWarnEnabled())
|
||||
{
|
||||
logger.warn("Retention schedule has more than one associated records management container. " +
|
||||
"This is not currently supported so only the first container will be considered. " +
|
||||
"(dispositionScheduleNodeRef=" + dispositionSchedule.getNodeRef().toString() + ")");
|
||||
LOGGER.warn("Retention schedule has more than one associated records management container. " +
|
||||
"This is not currently supported so only the first container will be considered. " +
|
||||
"(dispositionScheduleNodeRef=" + dispositionSchedule.getNodeRef().toString() + ")");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -627,42 +627,16 @@ public class DispositionServiceImpl extends ServiceBaseImpl
|
||||
* Initialises the details of the next disposition action based on the details of a disposition
|
||||
* action definition.
|
||||
*
|
||||
* @param nodeRef node reference
|
||||
* @param dispositionActionDefinition disposition action definition
|
||||
* @param nodeRef node reference
|
||||
* @param dispositionActionDefinition disposition action definition
|
||||
* @param allowContextFromAsOf true if the context date is allowed to be obtained from the disposition "as of" property.
|
||||
*/
|
||||
private void initialiseDispositionAction(NodeRef nodeRef, DispositionActionDefinition dispositionActionDefinition)
|
||||
private void initialiseDispositionAction(NodeRef nodeRef, DispositionActionDefinition dispositionActionDefinition, boolean allowContextFromAsOf)
|
||||
{
|
||||
// Create the properties
|
||||
Map<QName, Serializable> props = new HashMap<QName, Serializable>(10);
|
||||
|
||||
// Calculate the asOf date
|
||||
Date asOfDate = null;
|
||||
Period period = dispositionActionDefinition.getPeriod();
|
||||
if (period != null)
|
||||
{
|
||||
Date contextDate = null;
|
||||
|
||||
// Get the period properties value
|
||||
QName periodProperty = dispositionActionDefinition.getPeriodProperty();
|
||||
if (periodProperty != null)
|
||||
{
|
||||
// doesn't matter if the period property isn't set ... the asOfDate will get updated later
|
||||
// when the value of the period property is set
|
||||
contextDate = (Date)this.nodeService.getProperty(nodeRef, periodProperty);
|
||||
}
|
||||
else
|
||||
{
|
||||
// for now use 'NOW' as the default context date
|
||||
// TODO set the default period property ... cut off date or last disposition date depending on context
|
||||
contextDate = new Date();
|
||||
}
|
||||
|
||||
// Calculate the as of date
|
||||
if (contextDate != null)
|
||||
{
|
||||
asOfDate = period.getNextDate(contextDate);
|
||||
}
|
||||
}
|
||||
Date asOfDate = calculateAsOfDate(nodeRef, dispositionActionDefinition, allowContextFromAsOf);
|
||||
|
||||
// Set the property values
|
||||
props.put(PROP_DISPOSITION_ACTION_ID, dispositionActionDefinition.getId());
|
||||
@@ -690,6 +664,50 @@ public class DispositionServiceImpl extends ServiceBaseImpl
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Compute the "disposition as of" date (if necessary) for a disposition action and a node.
|
||||
*
|
||||
* @param nodeRef The node which the schedule applies to.
|
||||
* @param dispositionActionDefinition The definition of the disposition action.
|
||||
* @param allowContextFromAsOf true if the context date is allowed to be obtained from the disposition "as of" property.
|
||||
* @return The new "disposition as of" date.
|
||||
*/
|
||||
@Override
|
||||
public Date calculateAsOfDate(NodeRef nodeRef, DispositionActionDefinition dispositionActionDefinition,
|
||||
boolean allowContextFromAsOf)
|
||||
{
|
||||
// Calculate the asOf date
|
||||
Date asOfDate = null;
|
||||
Period period = dispositionActionDefinition.getPeriod();
|
||||
if (period != null)
|
||||
{
|
||||
Date contextDate = null;
|
||||
|
||||
// Get the period properties value
|
||||
QName periodProperty = dispositionActionDefinition.getPeriodProperty();
|
||||
if (periodProperty != null && (allowContextFromAsOf
|
||||
|| !RecordsManagementModel.PROP_DISPOSITION_AS_OF.equals(periodProperty)))
|
||||
{
|
||||
// doesn't matter if the period property isn't set ... the asOfDate will get updated later
|
||||
// when the value of the period property is set
|
||||
contextDate = (Date)this.nodeService.getProperty(nodeRef, periodProperty);
|
||||
}
|
||||
else
|
||||
{
|
||||
// for now use 'NOW' as the default context date
|
||||
// TODO set the default period property ... cut off date or last disposition date depending on context
|
||||
contextDate = new Date();
|
||||
}
|
||||
|
||||
// Calculate the as of date
|
||||
if (contextDate != null)
|
||||
{
|
||||
asOfDate = period.getNextDate(contextDate);
|
||||
}
|
||||
}
|
||||
return asOfDate;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.alfresco.module.org_alfresco_module_rm.disposition.DispositionService#isNextDispositionActionEligible(org.alfresco.service.cmr.repository.NodeRef)
|
||||
*/
|
||||
@@ -914,63 +932,7 @@ public class DispositionServiceImpl extends ServiceBaseImpl
|
||||
nodeService.addAspect(nodeRef, ASPECT_DISPOSITION_LIFECYCLE, null);
|
||||
}
|
||||
|
||||
// Create the properties
|
||||
Map<QName, Serializable> props = new HashMap<QName, Serializable>(10);
|
||||
|
||||
// Calculate the asOf date
|
||||
Date asOfDate = null;
|
||||
Period period = nextDispositionActionDefinition.getPeriod();
|
||||
if (period != null)
|
||||
{
|
||||
Date contextDate = null;
|
||||
|
||||
// Get the period properties value
|
||||
QName periodProperty = nextDispositionActionDefinition.getPeriodProperty();
|
||||
if (periodProperty != null &&
|
||||
!RecordsManagementModel.PROP_DISPOSITION_AS_OF.equals(periodProperty))
|
||||
{
|
||||
// doesn't matter if the period property isn't set ... the asOfDate will get updated later
|
||||
// when the value of the period property is set
|
||||
contextDate = (Date) nodeService.getProperty(nodeRef, periodProperty);
|
||||
}
|
||||
else
|
||||
{
|
||||
// for now use 'NOW' as the default context date
|
||||
// TODO set the default period property ... cut off date or last disposition date depending on context
|
||||
contextDate = new Date();
|
||||
}
|
||||
|
||||
// Calculate the as of date
|
||||
if (contextDate != null)
|
||||
{
|
||||
asOfDate = period.getNextDate(contextDate);
|
||||
}
|
||||
}
|
||||
|
||||
// Set the property values
|
||||
props.put(PROP_DISPOSITION_ACTION_ID, nextDispositionActionDefinition.getId());
|
||||
props.put(PROP_DISPOSITION_ACTION, nextDispositionActionDefinition.getName());
|
||||
if (asOfDate != null)
|
||||
{
|
||||
props.put(PROP_DISPOSITION_AS_OF, asOfDate);
|
||||
}
|
||||
|
||||
// Create a new disposition action object
|
||||
NodeRef dispositionActionNodeRef = nodeService.createNode(
|
||||
nodeRef,
|
||||
ASSOC_NEXT_DISPOSITION_ACTION,
|
||||
ASSOC_NEXT_DISPOSITION_ACTION,
|
||||
TYPE_DISPOSITION_ACTION,
|
||||
props).getChildRef();
|
||||
DispositionAction da = new DispositionActionImpl(serviceRegistry, dispositionActionNodeRef);
|
||||
|
||||
// Create the events
|
||||
List<RecordsManagementEvent> events = nextDispositionActionDefinition.getEvents();
|
||||
for (RecordsManagementEvent event : events)
|
||||
{
|
||||
// For every event create an entry on the action
|
||||
da.addEventCompletionDetails(event);
|
||||
}
|
||||
initialiseDispositionAction(nodeRef, nextDispositionActionDefinition, false);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -1059,6 +1059,8 @@ public class RecordServiceImpl extends BaseBehaviourBean
|
||||
{
|
||||
NodeRef versionRecord = null;
|
||||
|
||||
|
||||
recordableVersionService.createSnapshotVersion(nodeRef);
|
||||
// wire record up to previous record
|
||||
VersionHistory versionHistory = versionService.getVersionHistory(nodeRef);
|
||||
if (versionHistory != null)
|
||||
|
@@ -59,8 +59,7 @@ public interface RecordableVersionService
|
||||
boolean isRecordedVersion(Version version);
|
||||
|
||||
/**
|
||||
* If the version is a recorded version, gets the related version
|
||||
* record.
|
||||
* If the version is a recorded version, gets the related version record.
|
||||
*
|
||||
* @param version version
|
||||
* @return NodeRef node reference of version record
|
||||
@@ -76,16 +75,27 @@ public interface RecordableVersionService
|
||||
Version getRecordedVersion(NodeRef record);
|
||||
|
||||
/**
|
||||
* Creates a record from the latest version, marking it as recorded.
|
||||
* Creates a record from the latest frozen version, marking it as recorded.
|
||||
* <p>
|
||||
* Does not create a record if the node is not versionable or the latest
|
||||
* version is already recorded.
|
||||
* Does not create a record if the node is not versionable or the latest version is already recorded.
|
||||
*
|
||||
* @param nodeRef node reference
|
||||
* @return NodeRef node reference to the created record.
|
||||
* @param nodeRef node reference
|
||||
* @return NodeRef node reference to the created record.
|
||||
*/
|
||||
NodeRef createRecordFromLatestVersion(NodeRef filePlan, NodeRef nodeRef);
|
||||
|
||||
/**
|
||||
* Creates a record from the latest version, marking it as recorded.
|
||||
* <p>
|
||||
* Does not create a record if the node is not versionable or the latest version is already recorded.
|
||||
*
|
||||
* @param nodeRef parent node reference
|
||||
* @param nodeRef node reference
|
||||
* @param autoVersion true, create new record version from latest version, false creates a record from the latest frozen version
|
||||
* @return NodeRef node reference to the created record.
|
||||
*/
|
||||
NodeRef createRecordFromLatestVersion(NodeRef filePlan, NodeRef nodeRef, boolean autoVersion);
|
||||
|
||||
/**
|
||||
* Indicates whether a record version is destroyed or not.
|
||||
*
|
||||
@@ -97,11 +107,23 @@ public interface RecordableVersionService
|
||||
/**
|
||||
* Marks a recorded version as destroyed.
|
||||
* <p>
|
||||
* Note this method does not destroy the associated record, instead it marks the
|
||||
* version as destroyed.
|
||||
* Note this method does not destroy the associated record, instead it marks the version as destroyed.
|
||||
*
|
||||
* @param version version
|
||||
*/
|
||||
void destroyRecordedVersion(Version version);
|
||||
|
||||
/**
|
||||
* Flag that indicate to create new version on record creation if current node is modified
|
||||
*
|
||||
* @return boolean true to auto-version on record creation, false to use latest versioned version
|
||||
*/
|
||||
boolean isEnableAutoVersionOnRecordCreation();
|
||||
|
||||
/**
|
||||
* Create a snapshot version of current node
|
||||
*
|
||||
* @param nodeRef node reference
|
||||
*/
|
||||
void createSnapshotVersion(NodeRef nodeRef);
|
||||
}
|
||||
|
@@ -33,6 +33,7 @@ import static org.codehaus.plexus.util.StringUtils.isNotBlank;
|
||||
import java.io.Serializable;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
@@ -66,6 +67,7 @@ import org.alfresco.util.PropertyMap;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.springframework.extensions.surf.util.I18NUtil;
|
||||
|
||||
/**
|
||||
* Recordable version service implementation
|
||||
@@ -88,6 +90,12 @@ public class RecordableVersionServiceImpl extends Version2ServiceImpl
|
||||
protected static final String PROP_VERSION_RECORD = "RecordVersion";
|
||||
protected static final String PROP_RECORDED_VERSION_DESTROYED = "RecordedVersionDestroyed";
|
||||
|
||||
/** I18N */
|
||||
private static final String AUTO_VERSION_ON_RECORD_CREATION = "rm.service.enable-autoversion-on-record-creation";
|
||||
|
||||
/** flag that enable auto-version on record creation */
|
||||
private boolean isEnableAutoVersionOnRecordCreation = false;
|
||||
|
||||
/** version aspect property names */
|
||||
private static final String[] VERSION_PROPERTY_NAMES = new String[]
|
||||
{
|
||||
@@ -130,7 +138,7 @@ public class RecordableVersionServiceImpl extends Version2ServiceImpl
|
||||
private ExtendedSecurityService extendedSecurityService;
|
||||
|
||||
/**
|
||||
* @param filePlanService file plan service
|
||||
* @param filePlanService file plan service
|
||||
*/
|
||||
public void setFilePlanService(FilePlanService filePlanService)
|
||||
{
|
||||
@@ -138,7 +146,7 @@ public class RecordableVersionServiceImpl extends Version2ServiceImpl
|
||||
}
|
||||
|
||||
/**
|
||||
* @param authenticationUtil authentication util helper
|
||||
* @param authenticationUtil authentication util helper
|
||||
*/
|
||||
public void setAuthenticationUtil(AuthenticationUtil authenticationUtil)
|
||||
{
|
||||
@@ -146,7 +154,7 @@ public class RecordableVersionServiceImpl extends Version2ServiceImpl
|
||||
}
|
||||
|
||||
/**
|
||||
* @param relationshipService relationship service
|
||||
* @param relationshipService relationship service
|
||||
*/
|
||||
public void setRelationshipService(RelationshipService relationshipService)
|
||||
{
|
||||
@@ -162,7 +170,7 @@ public class RecordableVersionServiceImpl extends Version2ServiceImpl
|
||||
}
|
||||
|
||||
/**
|
||||
* @param modelSecurityService model security service
|
||||
* @param modelSecurityService model security service
|
||||
*/
|
||||
public void setModelSecurityService(ModelSecurityService modelSecurityService)
|
||||
{
|
||||
@@ -186,7 +194,7 @@ public class RecordableVersionServiceImpl extends Version2ServiceImpl
|
||||
}
|
||||
|
||||
/**
|
||||
* @param extendedSecurityService extended security service
|
||||
* @param extendedSecurityService extended security service
|
||||
*/
|
||||
public void setExtendedSecurityService(ExtendedSecurityService extendedSecurityService)
|
||||
{
|
||||
@@ -194,7 +202,21 @@ public class RecordableVersionServiceImpl extends Version2ServiceImpl
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.alfresco.repo.version.Version2ServiceImpl#createVersion(org.alfresco.service.cmr.repository.NodeRef, java.util.Map, int)
|
||||
* @param isEnableAutoVersionOnRecordCreation
|
||||
*/
|
||||
public void setEnableAutoVersionOnRecordCreation(boolean isEnableAutoVersionOnRecordCreation)
|
||||
{
|
||||
this.isEnableAutoVersionOnRecordCreation = isEnableAutoVersionOnRecordCreation;
|
||||
}
|
||||
|
||||
public boolean isEnableAutoVersionOnRecordCreation()
|
||||
{
|
||||
return isEnableAutoVersionOnRecordCreation;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.alfresco.repo.version.Version2ServiceImpl#createVersion(org.alfresco.service.cmr.repository.NodeRef,
|
||||
* java.util.Map, int)
|
||||
*/
|
||||
@Override
|
||||
protected Version createVersion(NodeRef nodeRef, Map<String, Serializable> origVersionProperties, int versionNumber) throws ReservedVersionNameException
|
||||
@@ -214,7 +236,7 @@ public class RecordableVersionServiceImpl extends Version2ServiceImpl
|
||||
VersionType versionType = null;
|
||||
if (origVersionProperties != null)
|
||||
{
|
||||
versionType = (VersionType)origVersionProperties.get(VersionModel.PROP_VERSION_TYPE);
|
||||
versionType = (VersionType) origVersionProperties.get(VersionModel.PROP_VERSION_TYPE);
|
||||
}
|
||||
|
||||
// determine whether this is a recorded version or not
|
||||
@@ -241,12 +263,12 @@ public class RecordableVersionServiceImpl extends Version2ServiceImpl
|
||||
}
|
||||
|
||||
/**
|
||||
* @param nodeRef node reference
|
||||
* @return {@link NodeRef} associated file plan, default if none
|
||||
* @param nodeRef node reference
|
||||
* @return {@link NodeRef} associated file plan, default if none
|
||||
*/
|
||||
private NodeRef getFilePlan(NodeRef nodeRef)
|
||||
{
|
||||
NodeRef filePlan = (NodeRef)nodeService.getProperty(nodeRef, PROP_FILE_PLAN);
|
||||
NodeRef filePlan = (NodeRef) nodeService.getProperty(nodeRef, PROP_FILE_PLAN);
|
||||
if (filePlan == null)
|
||||
{
|
||||
filePlan = getFilePlan();
|
||||
@@ -255,7 +277,7 @@ public class RecordableVersionServiceImpl extends Version2ServiceImpl
|
||||
}
|
||||
|
||||
/**
|
||||
* @return {@link NodeRef} default file plan, exception if none
|
||||
* @return {@link NodeRef} default file plan, exception if none
|
||||
*/
|
||||
private NodeRef getFilePlan()
|
||||
{
|
||||
@@ -285,7 +307,7 @@ public class RecordableVersionServiceImpl extends Version2ServiceImpl
|
||||
boolean result = false;
|
||||
if (nodeService.hasAspect(nodeRef, RecordableVersionModel.ASPECT_VERSIONABLE))
|
||||
{
|
||||
String policyString = (String)nodeService.getProperty(nodeRef, PROP_RECORDABLE_VERSION_POLICY);
|
||||
String policyString = (String) nodeService.getProperty(nodeRef, PROP_RECORDABLE_VERSION_POLICY);
|
||||
if (policyString != null)
|
||||
{
|
||||
RecordableVersionPolicy policy = RecordableVersionPolicy.valueOf(policyString.toUpperCase());
|
||||
@@ -315,7 +337,7 @@ public class RecordableVersionServiceImpl extends Version2ServiceImpl
|
||||
NodeRef version = null;
|
||||
|
||||
if (versionProperties.containsKey(KEY_RECORDABLE_VERSION) &&
|
||||
((Boolean)versionProperties.get(KEY_RECORDABLE_VERSION)).booleanValue())
|
||||
((Boolean)versionProperties.get(KEY_RECORDABLE_VERSION)).booleanValue())
|
||||
{
|
||||
// create a recorded version
|
||||
version = createNewRecordedVersion(sourceTypeRef, versionHistoryRef, standardVersionProperties, versionProperties, versionNumber, nodeDetails);
|
||||
@@ -332,13 +354,13 @@ public class RecordableVersionServiceImpl extends Version2ServiceImpl
|
||||
/**
|
||||
* Creates a new recorded version
|
||||
*
|
||||
* @param sourceTypeRef source type name
|
||||
* @param versionHistoryRef version history reference
|
||||
* @param standardVersionProperties standard version properties
|
||||
* @param versionProperties version properties
|
||||
* @param versionNumber version number
|
||||
* @param nodeDetails policy scope
|
||||
* @return {@link NodeRef} record version
|
||||
* @param sourceTypeRef source type name
|
||||
* @param versionHistoryRef version history reference
|
||||
* @param standardVersionProperties standard version properties
|
||||
* @param versionProperties version properties
|
||||
* @param versionNumber version number
|
||||
* @param nodeDetails policy scope
|
||||
* @return {@link NodeRef} record version
|
||||
*/
|
||||
protected NodeRef createNewRecordedVersion(QName sourceTypeRef,
|
||||
NodeRef versionHistoryRef,
|
||||
@@ -365,14 +387,14 @@ public class RecordableVersionServiceImpl extends Version2ServiceImpl
|
||||
try
|
||||
{
|
||||
// get the destination file plan
|
||||
final NodeRef filePlan = (NodeRef)versionProperties.get(KEY_FILE_PLAN);
|
||||
final NodeRef filePlan = (NodeRef) versionProperties.get(KEY_FILE_PLAN);
|
||||
if (filePlan == null)
|
||||
{
|
||||
throw new AlfrescoRuntimeException("Can't create a new recorded version, because no file plan has been specified in the version properties.");
|
||||
}
|
||||
|
||||
// create a copy of the source node and place in the file plan
|
||||
final NodeRef nodeRef = (NodeRef)standardVersionProperties.get(Version2Model.PROP_QNAME_FROZEN_NODE_REF);
|
||||
final NodeRef nodeRef = (NodeRef) standardVersionProperties.get(Version2Model.PROP_QNAME_FROZEN_NODE_REF);
|
||||
|
||||
cmObjectType.disableCopy();
|
||||
try
|
||||
@@ -418,7 +440,7 @@ public class RecordableVersionServiceImpl extends Version2ServiceImpl
|
||||
nodeService.addAspect(versionNodeRef, Version2Model.ASPECT_VERSION, standardVersionProperties);
|
||||
|
||||
// add the recordedVersion aspect with link to record
|
||||
nodeService.addAspect(versionNodeRef, ASPECT_RECORDED_VERSION, Collections.singletonMap(PROP_RECORD_NODE_REF, (Serializable)record));
|
||||
nodeService.addAspect(versionNodeRef, ASPECT_RECORDED_VERSION, Collections.singletonMap(PROP_RECORD_NODE_REF, (Serializable) record));
|
||||
|
||||
// freeze auditable aspect information
|
||||
freezeAuditableAspect(nodeRef, versionNodeRef);
|
||||
@@ -459,8 +481,8 @@ public class RecordableVersionServiceImpl extends Version2ServiceImpl
|
||||
/**
|
||||
* Helper method to link the record to the previous version record
|
||||
*
|
||||
* @param nodeRef noderef source node reference
|
||||
* @param record record record node reference
|
||||
* @param nodeRef noderef source node reference
|
||||
* @param record record record node reference
|
||||
*/
|
||||
private void linkToPreviousVersionRecord(final NodeRef nodeRef, final NodeRef record)
|
||||
{
|
||||
@@ -483,8 +505,8 @@ public class RecordableVersionServiceImpl extends Version2ServiceImpl
|
||||
/**
|
||||
* Helper to get the latest version record for a given document (ie non-record)
|
||||
*
|
||||
* @param nodeRef node reference
|
||||
* @return NodeRef latest version record, null otherwise
|
||||
* @param nodeRef node reference
|
||||
* @return NodeRef latest version record, null otherwise
|
||||
*/
|
||||
private NodeRef getLatestVersionRecord(NodeRef nodeRef)
|
||||
{
|
||||
@@ -498,7 +520,7 @@ public class RecordableVersionServiceImpl extends Version2ServiceImpl
|
||||
for (Version previousVersion : previousVersions)
|
||||
{
|
||||
// look for the associated record
|
||||
final NodeRef previousRecord = (NodeRef)previousVersion.getVersionProperties().get(PROP_VERSION_RECORD);
|
||||
final NodeRef previousRecord = (NodeRef) previousVersion.getVersionProperties().get(PROP_VERSION_RECORD);
|
||||
if (previousRecord != null &&
|
||||
nodeService.exists(previousRecord))
|
||||
{
|
||||
@@ -563,17 +585,18 @@ public class RecordableVersionServiceImpl extends Version2ServiceImpl
|
||||
@Override
|
||||
protected Version getVersion(NodeRef versionRef)
|
||||
{
|
||||
|
||||
Version version = super.getVersion(versionRef);
|
||||
|
||||
// place the version record reference in the version properties
|
||||
NodeRef record = (NodeRef)dbNodeService.getProperty(versionRef, PROP_RECORD_NODE_REF);
|
||||
NodeRef record = (NodeRef) dbNodeService.getProperty(versionRef, PROP_RECORD_NODE_REF);
|
||||
if (record != null)
|
||||
{
|
||||
version.getVersionProperties().put(PROP_VERSION_RECORD, record);
|
||||
}
|
||||
|
||||
// place information about the destruction of the version record in the properties
|
||||
Boolean destroyed = (Boolean)dbNodeService.getProperty(versionRef, PROP_DESTROYED);
|
||||
Boolean destroyed = (Boolean) dbNodeService.getProperty(versionRef, PROP_DESTROYED);
|
||||
if (destroyed == null) { destroyed = Boolean.FALSE; }
|
||||
version.getVersionProperties().put(PROP_RECORDED_VERSION_DESTROYED, destroyed);
|
||||
|
||||
@@ -632,7 +655,7 @@ public class RecordableVersionServiceImpl extends Version2ServiceImpl
|
||||
if (dbNodeService.hasAspect(versionNodeRef, RecordableVersionModel.ASPECT_RECORDED_VERSION))
|
||||
{
|
||||
// get the version record
|
||||
result = (NodeRef)dbNodeService.getProperty(versionNodeRef, RecordableVersionModel.PROP_RECORD_NODE_REF);
|
||||
result = (NodeRef) dbNodeService.getProperty(versionNodeRef, RecordableVersionModel.PROP_RECORD_NODE_REF);
|
||||
|
||||
// check that the version record exists
|
||||
if (result != null &&
|
||||
@@ -649,8 +672,8 @@ public class RecordableVersionServiceImpl extends Version2ServiceImpl
|
||||
/**
|
||||
* Create Version Store Ref
|
||||
*
|
||||
* @param store ref
|
||||
* @return store ref for version store
|
||||
* @param store ref
|
||||
* @return store ref for version store
|
||||
*/
|
||||
public StoreRef convertStoreRef(StoreRef storeRef)
|
||||
{
|
||||
@@ -661,14 +684,25 @@ public class RecordableVersionServiceImpl extends Version2ServiceImpl
|
||||
* Convert the incomming node ref (with the version store protocol specified)
|
||||
* to the internal representation with the workspace protocol.
|
||||
*
|
||||
* @param nodeRef the incomming verison protocol node reference
|
||||
* @return the internal version node reference
|
||||
* @param nodeRef the incomming verison protocol node reference
|
||||
* @return the internal version node reference
|
||||
*/
|
||||
public NodeRef convertNodeRef(NodeRef nodeRef)
|
||||
{
|
||||
return new NodeRef(convertStoreRef(nodeRef.getStoreRef()), nodeRef.getId());
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.alfresco.module.org_alfresco_module_rm.version.RecordableVersionService#createRecordFromLatestVersion(org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.cmr.repository.NodeRef, autoVersion)
|
||||
*/
|
||||
@Override
|
||||
public NodeRef createRecordFromLatestVersion(final NodeRef filePlan, final NodeRef nodeRef, final boolean isEnableAutoVersionOnRecordCreation)
|
||||
{
|
||||
setEnableAutoVersionOnRecordCreation(isEnableAutoVersionOnRecordCreation);
|
||||
|
||||
return createRecordFromLatestVersion(filePlan, nodeRef);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.alfresco.module.org_alfresco_module_rm.version.RecordableVersionService#createRecordFromLatestVersion(org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.cmr.repository.NodeRef)
|
||||
*/
|
||||
@@ -683,6 +717,7 @@ public class RecordableVersionServiceImpl extends Version2ServiceImpl
|
||||
// check for versionable aspect
|
||||
if (nodeService.hasAspect(nodeRef, ContentModel.ASPECT_VERSIONABLE))
|
||||
{
|
||||
createSnapshotVersion(nodeRef);
|
||||
// get the latest version
|
||||
final Version currentVersion = getCurrentVersion(nodeRef);
|
||||
|
||||
@@ -751,7 +786,7 @@ public class RecordableVersionServiceImpl extends Version2ServiceImpl
|
||||
QName sourceTypeRef = getVersionType(currentVersion);
|
||||
|
||||
// patch-up owner information, which needs to be frozen for recorded versions
|
||||
String owner = (String)nodeService.getProperty(currentVersion.getFrozenStateNodeRef(), ContentModel.PROP_OWNER);
|
||||
String owner = (String) nodeService.getProperty(currentVersion.getFrozenStateNodeRef(), ContentModel.PROP_OWNER);
|
||||
if (owner != null)
|
||||
{
|
||||
versionProperties.put(PROP_FROZEN_OWNER, owner);
|
||||
@@ -779,7 +814,7 @@ public class RecordableVersionServiceImpl extends Version2ServiceImpl
|
||||
nodeService.addAspect(versionNodeRef, Version2Model.ASPECT_VERSION, versionProperties);
|
||||
|
||||
// add the recordedVersion aspect with link to record
|
||||
nodeService.addAspect(versionNodeRef, ASPECT_RECORDED_VERSION, Collections.singletonMap(PROP_RECORD_NODE_REF, (Serializable)record));
|
||||
nodeService.addAspect(versionNodeRef, ASPECT_RECORDED_VERSION, Collections.singletonMap(PROP_RECORD_NODE_REF, (Serializable) record));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -787,7 +822,7 @@ public class RecordableVersionServiceImpl extends Version2ServiceImpl
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.alfresco.module.org_alfresco_module_rm.version.RecordableVersionService#isRecordedVersionDestroyed(org.alfresco.service.cmr.version.Version)
|
||||
* @see org.alfresco.module.org_alfresco_module_rm.version.RecordableVersionService#isRecordedVersionDestroyed(org.alfresco.service.cmr.version.Version)
|
||||
*/
|
||||
@Override
|
||||
public boolean isRecordedVersionDestroyed(Version version)
|
||||
@@ -798,7 +833,7 @@ public class RecordableVersionServiceImpl extends Version2ServiceImpl
|
||||
NodeRef versionNodeRef = getVersionNodeRef(version);
|
||||
|
||||
// get the destroyed property value
|
||||
Boolean isDestroyed = (Boolean)dbNodeService.getProperty(versionNodeRef, PROP_DESTROYED);
|
||||
Boolean isDestroyed = (Boolean) dbNodeService.getProperty(versionNodeRef, PROP_DESTROYED);
|
||||
if (isDestroyed != null)
|
||||
{
|
||||
result = isDestroyed.booleanValue();
|
||||
@@ -831,8 +866,8 @@ public class RecordableVersionServiceImpl extends Version2ServiceImpl
|
||||
* Helper method to get the version number of a given version by inspecting the
|
||||
* name of the parent association.
|
||||
*
|
||||
* @param version version
|
||||
* @return int version number
|
||||
* @param version version
|
||||
* @return int version number
|
||||
*/
|
||||
private int getVersionNumber(Version version)
|
||||
{
|
||||
@@ -846,7 +881,7 @@ public class RecordableVersionServiceImpl extends Version2ServiceImpl
|
||||
/**
|
||||
* Helper method to get all the version aspect properties from an existing version
|
||||
*
|
||||
* @param version version
|
||||
* @param version version
|
||||
* @return Map<QName, Serializable> property values
|
||||
*/
|
||||
private Map<QName, Serializable> getVersionAspectProperties(Version version)
|
||||
@@ -881,11 +916,52 @@ public class RecordableVersionServiceImpl extends Version2ServiceImpl
|
||||
/**
|
||||
* Helper method to get the internal node reference of a version
|
||||
*
|
||||
* @param version version
|
||||
* @return NodeRef internal node reference to version
|
||||
* @param version version
|
||||
* @return NodeRef internal node reference to version
|
||||
*/
|
||||
private NodeRef getVersionNodeRef(Version version)
|
||||
{
|
||||
return convertNodeRef(version.getFrozenStateNodeRef());
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if current version of the node is modified compared with versioned version
|
||||
*
|
||||
* @param nodeRef internal node reference
|
||||
* @return boolean true if nodeRef is modified, otherwise false
|
||||
*/
|
||||
public boolean isCurrentVersionDirty(NodeRef nodeRef)
|
||||
{
|
||||
if (!nodeService.hasAspect(nodeRef, ContentModel.ASPECT_VERSIONABLE)) { return false; }
|
||||
|
||||
// get the latest version
|
||||
Version currentVersion = getCurrentVersion(nodeRef);
|
||||
Date modificationDate = (Date) nodeService.getProperty(nodeRef, ContentModel.PROP_MODIFIED);
|
||||
|
||||
if (currentVersion == null) { return true; }
|
||||
|
||||
// grab the frozen state
|
||||
NodeRef currentFrozenState = currentVersion.getFrozenStateNodeRef();
|
||||
Date frozenModificationDate = (Date) nodeService.getProperty(currentFrozenState, ContentModel.PROP_MODIFIED);
|
||||
|
||||
boolean versionStoreOutdated = ((frozenModificationDate != null) && (modificationDate.getTime() > frozenModificationDate.getTime()));
|
||||
return versionStoreOutdated;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see RecordableVersionService#createSnapshotVersion(NodeRef)
|
||||
*/
|
||||
public void createSnapshotVersion(NodeRef nodeRef)
|
||||
{
|
||||
boolean autoVersion = isEnableAutoVersionOnRecordCreation();
|
||||
// if the flag autoversion on record creation set, create new version on dirty nodes
|
||||
if (autoVersion && isCurrentVersionDirty(nodeRef))
|
||||
{
|
||||
Map<String, Serializable> autoVersionProperties = new HashMap<String, Serializable>(2);
|
||||
autoVersionProperties.put(VersionModel.PROP_VERSION_TYPE, VersionType.MINOR);
|
||||
autoVersionProperties.put(VersionModel.PROP_DESCRIPTION, I18NUtil.getMessage(AUTO_VERSION_ON_RECORD_CREATION));
|
||||
createVersion(nodeRef, autoVersionProperties);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@@ -0,0 +1,172 @@
|
||||
/*
|
||||
* #%L
|
||||
* Alfresco Records Management Module
|
||||
* %%
|
||||
* Copyright (C) 2005 - 2016 Alfresco Software Limited
|
||||
* %%
|
||||
* This file is part of the Alfresco software.
|
||||
* -
|
||||
* If the software was purchased under a paid Alfresco license, the terms of
|
||||
* the paid license agreement will prevail. Otherwise, the software is
|
||||
* provided under the following open source license terms:
|
||||
* -
|
||||
* Alfresco is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
* -
|
||||
* Alfresco is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
* -
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
* #L%
|
||||
*/
|
||||
package org.alfresco.module.org_alfresco_module_rm.test.integration.disposition;
|
||||
|
||||
import static org.alfresco.module.org_alfresco_module_rm.test.util.bdt.BehaviourTest.test;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
|
||||
import org.alfresco.model.ContentModel;
|
||||
import org.alfresco.module.org_alfresco_module_rm.action.impl.CutOffAction;
|
||||
import org.alfresco.module.org_alfresco_module_rm.action.impl.DestroyAction;
|
||||
import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionActionDefinition;
|
||||
import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionSchedule;
|
||||
import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionService;
|
||||
import org.alfresco.module.org_alfresco_module_rm.job.publish.DispositionActionDefinitionPublishExecutor;
|
||||
import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase;
|
||||
import org.alfresco.module.org_alfresco_module_rm.test.util.CommonRMTestUtils;
|
||||
import org.alfresco.module.org_alfresco_module_rm.test.util.bdt.BehaviourTest;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.alfresco.service.namespace.QName;
|
||||
import org.alfresco.util.ApplicationContextHelper;
|
||||
import org.springframework.extensions.webscripts.GUID;
|
||||
|
||||
/**
|
||||
* Integration tests for updating the disposition schedule.
|
||||
*
|
||||
* @author Tom Page
|
||||
* @since 2.3.1
|
||||
*/
|
||||
public class UpdateDispositionScheduleTest extends BaseRMTestCase
|
||||
{
|
||||
/** A unique prefix for the constants in this test. */
|
||||
protected static final String TEST_PREFIX = UpdateDispositionScheduleTest.class.getName() + GUID.generate() + "_";
|
||||
/** The name to use for the category. */
|
||||
protected static final String CATEGORY_NAME = TEST_PREFIX + "Category";
|
||||
/** The name to use for the folder. */
|
||||
protected static final String FOLDER_NAME = TEST_PREFIX + "Folder";
|
||||
/** The name to use for the record. */
|
||||
protected static final String RECORD_NAME = TEST_PREFIX + "Record";
|
||||
|
||||
/** The executor for the disposition update job. */
|
||||
private DispositionActionDefinitionPublishExecutor dispositionActionDefinitionPublishExecutor;
|
||||
/** The internal disposition service is used to avoid permissions issues when updating the record. */
|
||||
private DispositionService internalDispositionService;
|
||||
|
||||
/** The category node. */
|
||||
private NodeRef category;
|
||||
/** The folder node. */
|
||||
private NodeRef folder;
|
||||
/** The record node. */
|
||||
private NodeRef record;
|
||||
/** The 'disposition as of' date from before the 'when' step. */
|
||||
private Date originalAsOfDate;
|
||||
|
||||
@Override
|
||||
protected void setUp() throws Exception
|
||||
{
|
||||
super.setUp();
|
||||
|
||||
BehaviourTest.initBehaviourTests(retryingTransactionHelper);
|
||||
|
||||
// Get the application context
|
||||
applicationContext = ApplicationContextHelper.getApplicationContext(getConfigLocations());
|
||||
dispositionActionDefinitionPublishExecutor = applicationContext.getBean(DispositionActionDefinitionPublishExecutor.class);
|
||||
internalDispositionService = (DispositionService) applicationContext.getBean("dispositionService");
|
||||
}
|
||||
|
||||
/**
|
||||
* <a href="https://issues.alfresco.com/jira/browse/RM-3386">RM-3386</a>
|
||||
* <p><pre>
|
||||
* Given a record subject to a disposition schedule
|
||||
* And the next step is due to run at some period after the date the content was created
|
||||
* When I update the period of the next step (and wait for this to be processed)
|
||||
* Then the "as of" date is updated to be at the new period after the creation date.
|
||||
* </pre>
|
||||
*/
|
||||
public void testUpdatePeriod()
|
||||
{
|
||||
test()
|
||||
.given(() -> {
|
||||
// Create a category.
|
||||
category = filePlanService.createRecordCategory(filePlan, CATEGORY_NAME);
|
||||
// Create a disposition schedule for the category (Cut off immediately, then Destroy 1 year after the creation date).
|
||||
DispositionSchedule dispSched = utils.createBasicDispositionSchedule(category, "instructions", "authority", true, false);
|
||||
Map<QName, Serializable> cutOffParams = ImmutableMap.of(PROP_DISPOSITION_ACTION_NAME, CutOffAction.NAME,
|
||||
PROP_DISPOSITION_DESCRIPTION, "description",
|
||||
PROP_DISPOSITION_PERIOD, CommonRMTestUtils.PERIOD_IMMEDIATELY);
|
||||
dispositionService.addDispositionActionDefinition(dispSched, cutOffParams);
|
||||
Map<QName, Serializable> destroyParams = ImmutableMap.of(PROP_DISPOSITION_ACTION_NAME, DestroyAction.NAME,
|
||||
PROP_DISPOSITION_DESCRIPTION, "description",
|
||||
PROP_DISPOSITION_PERIOD, CommonRMTestUtils.PERIOD_ONE_YEAR,
|
||||
PROP_DISPOSITION_PERIOD_PROPERTY, ContentModel.PROP_CREATED);
|
||||
dispositionService.addDispositionActionDefinition(dispSched, destroyParams);
|
||||
// Create a folder containing a record within the category.
|
||||
folder = recordFolderService.createRecordFolder(category, FOLDER_NAME);
|
||||
record = fileFolderService.create(folder, RECORD_NAME, ContentModel.TYPE_CONTENT).getNodeRef();
|
||||
|
||||
dispositionService.cutoffDisposableItem(record);
|
||||
// Ensure the update has been applied to the record.
|
||||
internalDispositionService.updateNextDispositionAction(record);
|
||||
|
||||
originalAsOfDate = dispositionService.getNextDispositionAction(record).getAsOfDate();
|
||||
})
|
||||
.when(() -> {
|
||||
// Update the Destroy step to be 3 years after the creation date.
|
||||
DispositionSchedule dispSched = dispositionService.getDispositionSchedule(category);
|
||||
DispositionActionDefinition destroy = dispSched.getDispositionActionDefinitionByName(DestroyAction.NAME);
|
||||
Map<QName, Serializable> destroyParams = ImmutableMap.of(PROP_DISPOSITION_ACTION_NAME, DestroyAction.NAME,
|
||||
PROP_DISPOSITION_DESCRIPTION, "description",
|
||||
PROP_DISPOSITION_PERIOD, CommonRMTestUtils.PERIOD_THREE_YEARS,
|
||||
PROP_DISPOSITION_PERIOD_PROPERTY, ContentModel.PROP_CREATED);
|
||||
dispositionService.updateDispositionActionDefinition(destroy, destroyParams);
|
||||
|
||||
// Make the disposition action definition update job run.
|
||||
dispositionActionDefinitionPublishExecutor.publish(destroy.getNodeRef());
|
||||
})
|
||||
.then()
|
||||
.expect(true)
|
||||
.from(() -> aboutTwoYearsApart(originalAsOfDate, dispositionService.getNextDispositionAction(record).getAsOfDate()))
|
||||
.because("Increasing the destroy period by two years should increase the 'as of' date by two years.");
|
||||
}
|
||||
|
||||
/**
|
||||
* Check that the two given dates are approximately two years apart.
|
||||
* <p>
|
||||
* This actually just checks that they're more than one and less than three years apart, because leap years make
|
||||
* things hard to calculate.
|
||||
*
|
||||
* @return true if the two dates are about two years apart.
|
||||
*/
|
||||
private boolean aboutTwoYearsApart(Date start, Date end)
|
||||
{
|
||||
long days = daysBetween(start, end);
|
||||
long yearInDays = 365;
|
||||
return (yearInDays < days) && (days < 3 * yearInDays);
|
||||
}
|
||||
|
||||
/** Find the number of days between the two dates. */
|
||||
private long daysBetween(Date start, Date end)
|
||||
{
|
||||
return TimeUnit.MILLISECONDS.toDays(end.getTime() - start.getTime());
|
||||
}
|
||||
}
|
@@ -28,15 +28,18 @@
|
||||
package org.alfresco.module.org_alfresco_module_rm.test.integration.version;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.alfresco.model.ContentModel;
|
||||
import org.alfresco.module.org_alfresco_module_rm.version.RecordableVersionService;
|
||||
import org.alfresco.module.org_alfresco_module_rm.version.RecordableVersionServiceImpl;
|
||||
import org.alfresco.repo.version.VersionModel;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.alfresco.service.cmr.version.Version;
|
||||
import org.alfresco.service.cmr.version.VersionType;
|
||||
import org.alfresco.service.namespace.QName;
|
||||
import org.alfresco.util.GUID;
|
||||
|
||||
/**
|
||||
@@ -57,7 +60,7 @@ public class DeclareAsRecordVersionTest extends RecordableVersionsBaseTest
|
||||
protected void initServices()
|
||||
{
|
||||
super.initServices();
|
||||
recordableVersionService = (RecordableVersionService)applicationContext.getBean("RecordableVersionService");
|
||||
recordableVersionService = (RecordableVersionService) applicationContext.getBean("RecordableVersionService");
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -214,4 +217,184 @@ public class DeclareAsRecordVersionTest extends RecordableVersionsBaseTest
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Given versionable content with a recorded latest version and autoversion is true
|
||||
* When I declare this version record and contains local modifications
|
||||
* Then a new minor version is created for document
|
||||
*
|
||||
* @see https://issues.alfresco.com/jira/browse/RM-2368
|
||||
*/
|
||||
public void testCreateRecordFromLatestVersionAutoTrue()
|
||||
{
|
||||
doBehaviourDrivenTest(new BehaviourDrivenTest(dmCollaborator)
|
||||
{
|
||||
private NodeRef myDocument;
|
||||
private NodeRef versionedRecord;
|
||||
private Map<String, Serializable> versionProperties;
|
||||
private Date createdDate;
|
||||
private Date modificationDate;
|
||||
private String record_name = "initial_name";
|
||||
private String AUTO_VERSION_DESCRIPTION = "Auto Version on Record Creation";
|
||||
private boolean autoVersion = true;
|
||||
|
||||
public void given() throws Exception
|
||||
{
|
||||
// create a document
|
||||
myDocument = fileFolderService.create(dmFolder, GUID.generate(), ContentModel.TYPE_CONTENT).getNodeRef();
|
||||
createdDate = (Date) nodeService.getProperty(myDocument, ContentModel.PROP_CREATED);
|
||||
modificationDate = (Date) nodeService.getProperty(myDocument, ContentModel.PROP_MODIFIED);
|
||||
assertTrue("Modified date must be after or on creation date", createdDate.getTime() == modificationDate.getTime());
|
||||
|
||||
// Set initial set of properties
|
||||
Map<QName, Serializable> properties = new HashMap<QName, Serializable>(3);
|
||||
// Ensure default behaviour autoversion on change properties is set to false
|
||||
properties.put(ContentModel.PROP_AUTO_VERSION_PROPS, false);
|
||||
// Set initial name
|
||||
properties.put(ContentModel.PROP_NAME, "initial_name");
|
||||
nodeService.setProperties(myDocument, properties);
|
||||
nodeService.setProperty(myDocument, ContentModel.PROP_DESCRIPTION, DESCRIPTION);
|
||||
nodeService.addAspect(myDocument, ContentModel.ASPECT_OWNABLE, null);
|
||||
// make sure document is versionable
|
||||
nodeService.addAspect(myDocument, ContentModel.ASPECT_VERSIONABLE, null);
|
||||
// Change Type to a custom document
|
||||
nodeService.setType(myDocument, TYPE_CUSTOM_TYPE);
|
||||
|
||||
// setup version properties
|
||||
versionProperties = new HashMap<String, Serializable>(2);
|
||||
versionProperties.put(Version.PROP_DESCRIPTION, DESCRIPTION);
|
||||
versionProperties.put(VersionModel.PROP_VERSION_TYPE, VersionType.MAJOR);
|
||||
|
||||
// create initial version
|
||||
versionService.createVersion(myDocument, versionProperties);
|
||||
}
|
||||
|
||||
public void when()
|
||||
{
|
||||
// Apply a custom aspect
|
||||
nodeService.addAspect(myDocument, ContentModel.ASPECT_TITLED, null);
|
||||
// Update properties
|
||||
nodeService.setProperty(myDocument, ContentModel.PROP_NAME, "updated_name");
|
||||
nodeService.setProperty(myDocument, ContentModel.PROP_DESCRIPTION, DESCRIPTION);
|
||||
// test RM-2368
|
||||
versionedRecord = recordableVersionService.createRecordFromLatestVersion(filePlan, myDocument, autoVersion);
|
||||
}
|
||||
|
||||
public void then()
|
||||
{
|
||||
// Properties updated / flag as modified
|
||||
// check the created record
|
||||
assertNotNull(versionedRecord);
|
||||
assertTrue(recordService.isRecord(versionedRecord));
|
||||
|
||||
// check the record type is correct
|
||||
assertEquals(TYPE_CUSTOM_TYPE, nodeService.getType(versionedRecord));
|
||||
|
||||
// assert the current version is recorded
|
||||
assertTrue(recordableVersionService.isCurrentVersionRecorded(myDocument));
|
||||
|
||||
// get name of record
|
||||
record_name = (String) nodeService.getProperty(versionedRecord, ContentModel.PROP_NAME);
|
||||
|
||||
// new version is create, current node was modified
|
||||
assertTrue("Name was updated:", record_name.contains("updated_name"));
|
||||
// check record
|
||||
checkRecordedVersion(myDocument, AUTO_VERSION_DESCRIPTION, "1.1");
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* Given versionable content with a recorded latest version and autoversion is false
|
||||
* When I declare this version record and contains local modifications
|
||||
* Then a record is created from latest version
|
||||
*
|
||||
* @see https://issues.alfresco.com/jira/browse/RM-2368
|
||||
*/
|
||||
public void testCreateRecordFromLatestVersion()
|
||||
{
|
||||
doBehaviourDrivenTest(new BehaviourDrivenTest(dmCollaborator)
|
||||
{
|
||||
private NodeRef myDocument;
|
||||
private NodeRef versionedRecord;
|
||||
private Map<String, Serializable> versionProperties;
|
||||
private Date createdDate;
|
||||
private Date modificationDate;
|
||||
private String record_name = "initial_name";
|
||||
private boolean autoVersion = false;
|
||||
|
||||
public void given() throws Exception
|
||||
{
|
||||
// create a document
|
||||
myDocument = fileFolderService.create(dmFolder, GUID.generate(), ContentModel.TYPE_CONTENT).getNodeRef();
|
||||
createdDate = (Date) nodeService.getProperty(myDocument, ContentModel.PROP_CREATED);
|
||||
modificationDate = (Date) nodeService.getProperty(myDocument, ContentModel.PROP_MODIFIED);
|
||||
assertTrue("Modified date must be after or on creation date", createdDate.getTime() == modificationDate.getTime());
|
||||
|
||||
// Set initial set of properties
|
||||
Map<QName, Serializable> properties = new HashMap<QName, Serializable>(3);
|
||||
// Ensure default behaviour autoversion on change properties is set to false
|
||||
properties.put(ContentModel.PROP_AUTO_VERSION_PROPS, false);
|
||||
// Set initial name
|
||||
properties.put(ContentModel.PROP_NAME, "initial_name");
|
||||
nodeService.setProperties(myDocument, properties);
|
||||
nodeService.setProperty(myDocument, ContentModel.PROP_DESCRIPTION, DESCRIPTION);
|
||||
nodeService.addAspect(myDocument, ContentModel.ASPECT_OWNABLE, null);
|
||||
// make sure document is versionable
|
||||
nodeService.addAspect(myDocument, ContentModel.ASPECT_VERSIONABLE, null);
|
||||
// Change Type to a custom document
|
||||
nodeService.setType(myDocument, TYPE_CUSTOM_TYPE);
|
||||
|
||||
// setup version properties
|
||||
versionProperties = new HashMap<String, Serializable>(2);
|
||||
versionProperties.put(Version.PROP_DESCRIPTION, DESCRIPTION);
|
||||
versionProperties.put(VersionModel.PROP_VERSION_TYPE, VersionType.MAJOR);
|
||||
|
||||
// create initial version
|
||||
versionService.createVersion(myDocument, versionProperties);
|
||||
}
|
||||
|
||||
public void when()
|
||||
{
|
||||
// Apply a custom aspect
|
||||
nodeService.addAspect(myDocument, ContentModel.ASPECT_TITLED, null);
|
||||
// Update properties
|
||||
nodeService.setProperty(myDocument, ContentModel.PROP_NAME, "initial_name");
|
||||
nodeService.setProperty(myDocument, ContentModel.PROP_DESCRIPTION, DESCRIPTION);
|
||||
// test RM-2368
|
||||
versionedRecord = recordableVersionService.createRecordFromLatestVersion(filePlan, myDocument, autoVersion);
|
||||
}
|
||||
|
||||
public void then()
|
||||
{
|
||||
// Properties updated / flag as modified
|
||||
// check the created record
|
||||
assertNotNull(versionedRecord);
|
||||
assertTrue(recordService.isRecord(versionedRecord));
|
||||
|
||||
// check the record type is correct
|
||||
assertEquals(TYPE_CUSTOM_TYPE, nodeService.getType(versionedRecord));
|
||||
|
||||
// assert the current version is recorded
|
||||
assertTrue(recordableVersionService.isCurrentVersionRecorded(myDocument));
|
||||
|
||||
// get name of record
|
||||
record_name = (String) nodeService.getProperty(versionedRecord, ContentModel.PROP_NAME);
|
||||
|
||||
// record is created based on existing frozen, which does not contain any modification of node
|
||||
assertTrue("Name is not modified: ", record_name.contains("initial_name"));
|
||||
checkRecordedVersion(myDocument, DESCRIPTION, "1.0");
|
||||
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@@ -87,6 +87,8 @@ public class CommonRMTestUtils implements RecordsManagementModel
|
||||
public static final String PERIOD_NONE = "none|0";
|
||||
public static final String PERIOD_IMMEDIATELY = "immediately|0";
|
||||
public static final String PERIOD_ONE_WEEK = "week|1";
|
||||
public static final String PERIOD_ONE_YEAR = "year|1";
|
||||
public static final String PERIOD_THREE_YEARS = "year|3";
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
@@ -323,7 +325,7 @@ public class CommonRMTestUtils implements RecordsManagementModel
|
||||
|
||||
}, AuthenticationUtil.getAdminUserName());
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public void closeFolder(final NodeRef recordFolder)
|
||||
{
|
||||
|
@@ -0,0 +1,103 @@
|
||||
/*
|
||||
* #%L
|
||||
* Alfresco Records Management Module
|
||||
* %%
|
||||
* Copyright (C) 2005 - 2016 Alfresco Software Limited
|
||||
* %%
|
||||
* This file is part of the Alfresco software.
|
||||
* -
|
||||
* If the software was purchased under a paid Alfresco license, the terms of
|
||||
* the paid license agreement will prevail. Otherwise, the software is
|
||||
* provided under the following open source license terms:
|
||||
* -
|
||||
* Alfresco is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
* -
|
||||
* Alfresco is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
* -
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
* #L%
|
||||
*/
|
||||
|
||||
package org.alfresco.module.org_alfresco_module_rm.action.impl;
|
||||
|
||||
import static org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel.PROP_DISPOSITION_AS_OF;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.verify;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionAction;
|
||||
import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionActionDefinition;
|
||||
import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionService;
|
||||
import org.alfresco.service.cmr.repository.ChildAssociationRef;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.alfresco.service.cmr.repository.NodeService;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
/**
|
||||
* Unit tests for {@link BroadcastDispositionActionDefinitionUpdateAction}.
|
||||
*
|
||||
* @author Tom Page
|
||||
* @since 2.3.1
|
||||
*/
|
||||
public class BroadcastDispositionActionDefinitionUpdateActionUnitTest
|
||||
{
|
||||
/** The node under the category containing information about the definition of the action. */
|
||||
private static final NodeRef DISPOSITION_ACTION_DEF_NODE = new NodeRef("disposition://Action/Def");
|
||||
/** The node containing the details of the next disposition step for the content. */
|
||||
private static final NodeRef NEXT_ACTION_NODE_REF = new NodeRef("next://Step/");
|
||||
/** The node being subject to the disposition step. */
|
||||
private static final NodeRef CONTENT_NODE_REF = new NodeRef("content://Node/Ref");
|
||||
|
||||
/** The class under test. */
|
||||
private BroadcastDispositionActionDefinitionUpdateAction action = new BroadcastDispositionActionDefinitionUpdateAction();
|
||||
|
||||
private NodeService mockNodeService = mock(NodeService.class);
|
||||
private DispositionService mockDispositionService = mock(DispositionService.class);
|
||||
|
||||
/** Inject the mock services into the class under test and link the content and next action nodes. */
|
||||
@Before
|
||||
public void setUp()
|
||||
{
|
||||
action.setNodeService(mockNodeService);
|
||||
action.setDispositionService(mockDispositionService);
|
||||
|
||||
ChildAssociationRef mockAssocRef = mock(ChildAssociationRef.class);
|
||||
when(mockNodeService.getPrimaryParent(NEXT_ACTION_NODE_REF)).thenReturn(mockAssocRef);
|
||||
when(mockAssocRef.getParentRef()).thenReturn(CONTENT_NODE_REF);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check that the disposition service is used to determine the "disposition as of" date when changes are made to the
|
||||
* disposition period.
|
||||
*/
|
||||
@Test
|
||||
public void testPersistPeriodChanges()
|
||||
{
|
||||
// Set up the data associated with the next disposition action.
|
||||
DispositionAction mockAction = mock(DispositionAction.class);
|
||||
when(mockAction.getNodeRef()).thenReturn(NEXT_ACTION_NODE_REF);
|
||||
DispositionActionDefinition mockDispositionActionDefinition = mock(DispositionActionDefinition.class);
|
||||
when(mockAction.getDispositionActionDefinition()).thenReturn(mockDispositionActionDefinition);
|
||||
when(mockAction.getName()).thenReturn("mockAction");
|
||||
// Set up the disposition service to return a known "disposition as of" date.
|
||||
Date asOfDate = new Date();
|
||||
when(mockDispositionService.calculateAsOfDate(CONTENT_NODE_REF, mockDispositionActionDefinition, false))
|
||||
.thenReturn(asOfDate);
|
||||
|
||||
// Call the method under test.
|
||||
action.persistPeriodChanges(DISPOSITION_ACTION_DEF_NODE, mockAction);
|
||||
|
||||
// Check that the "disposition as of" date has been set on the next action.
|
||||
verify(mockNodeService).setProperty(NEXT_ACTION_NODE_REF, PROP_DISPOSITION_AS_OF, asOfDate);
|
||||
}
|
||||
}
|
@@ -0,0 +1,102 @@
|
||||
/*
|
||||
* #%L
|
||||
* Alfresco Records Management Module
|
||||
* %%
|
||||
* Copyright (C) 2005 - 2016 Alfresco Software Limited
|
||||
* %%
|
||||
* This file is part of the Alfresco software.
|
||||
* -
|
||||
* If the software was purchased under a paid Alfresco license, the terms of
|
||||
* the paid license agreement will prevail. Otherwise, the software is
|
||||
* provided under the following open source license terms:
|
||||
* -
|
||||
* Alfresco is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
* -
|
||||
* Alfresco is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
* -
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
* #L%
|
||||
*/
|
||||
|
||||
package org.alfresco.module.org_alfresco_module_rm.disposition;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNull;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import org.alfresco.model.ContentModel;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.alfresco.service.cmr.repository.NodeService;
|
||||
import org.alfresco.service.cmr.repository.Period;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
/**
|
||||
* Unit tests for {@link DispositionServiceImpl}.
|
||||
*
|
||||
* @author Tom Page
|
||||
* @since 2.3.1
|
||||
*/
|
||||
public class DispositionServiceImplUnitTest
|
||||
{
|
||||
/** The node being subject to the disposition step. */
|
||||
NodeRef CONTENT_NODE_REF = new NodeRef("content://node/");
|
||||
|
||||
/** The class under test. */
|
||||
private DispositionServiceImpl dispositionService = new DispositionServiceImpl();
|
||||
|
||||
private NodeService mockNodeService = mock(NodeService.class);
|
||||
|
||||
@Before
|
||||
public void setUp()
|
||||
{
|
||||
dispositionService.setNodeService(mockNodeService);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check that the relevant information is retrieved from the DispositionActionDefinition in order to determine the
|
||||
* "disposition as of" date.
|
||||
*/
|
||||
@Test
|
||||
public void testCalculateAsOfDate()
|
||||
{
|
||||
// Set up a mock for the disposition action definition.
|
||||
DispositionActionDefinition mockDispositionActionDefinition = mock(DispositionActionDefinition.class);
|
||||
Period mockPeriod = mock(Period.class);
|
||||
when(mockDispositionActionDefinition.getPeriod()).thenReturn(mockPeriod);
|
||||
when(mockDispositionActionDefinition.getPeriodProperty()).thenReturn(ContentModel.PROP_CREATED);
|
||||
// Set up a created date and another date that is some Period later.
|
||||
Date createdDate = new Date(1234567890);
|
||||
when(mockNodeService.getProperty(CONTENT_NODE_REF, ContentModel.PROP_CREATED)).thenReturn(createdDate);
|
||||
Date nextDate = new Date(1240000000);
|
||||
when(mockPeriod.getNextDate(createdDate)).thenReturn(nextDate);
|
||||
|
||||
// Call the method under test.
|
||||
Date asOfDate = dispositionService.calculateAsOfDate(CONTENT_NODE_REF, mockDispositionActionDefinition, true);
|
||||
|
||||
assertEquals("Unexpected calculation for 'as of' date", nextDate, asOfDate);
|
||||
}
|
||||
|
||||
/** Check that the calculated "disposition as of" date is null if a null period is given. */
|
||||
@Test
|
||||
public void testCalculateAsOfDate_nullPeriod()
|
||||
{
|
||||
DispositionActionDefinition mockDispositionActionDefinition = mock(DispositionActionDefinition.class);
|
||||
when(mockDispositionActionDefinition.getPeriod()).thenReturn(null);
|
||||
|
||||
// Call the method under test.
|
||||
Date asOfDate = dispositionService.calculateAsOfDate(CONTENT_NODE_REF, mockDispositionActionDefinition, true);
|
||||
|
||||
assertNull("It should not be possible to determine the 'as of' date.", asOfDate);
|
||||
}
|
||||
}
|
@@ -24,24 +24,6 @@
|
||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
* #L%
|
||||
*/
|
||||
/*
|
||||
* Copyright (C) 2005-2014 Alfresco Software Limited.
|
||||
*
|
||||
* This file is part of Alfresco
|
||||
*
|
||||
* Alfresco is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Alfresco is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package org.alfresco.repo.web.scripts.roles;
|
||||
|
||||
|
Reference in New Issue
Block a user