Merge remote-tracking branch 'remotes/origin/master' into feature/APPS-172_RemoveDeclareAsActions

This commit is contained in:
Claudia Agache
2020-06-11 09:53:38 +03:00
9 changed files with 98 additions and 92 deletions

View File

@@ -276,7 +276,6 @@
<property name="kinds"> <property name="kinds">
<list> <list>
<value>RECORD</value> <value>RECORD</value>
<value>RECORD_FOLDER</value>
</list> </list>
</property> </property>
<property name="conditions"> <property name="conditions">

View File

@@ -62,6 +62,27 @@
<property name="index" value="40" /> <property name="index" value="40" />
</bean> </bean>
<bean id="rmFileVersionRecordsCapability"
parent="declarativeCapability">
<property name="name" value="FileVersionRecords" />
<property name="permission" value="FileVersionRecords" />
<property name="kinds">
<list>
<value>RECORD_FOLDER</value>
</list>
</property>
<property name="conditions">
<map>
<entry key="capabilityCondition.filling" value="true" />
<entry key="capabilityCondition.cutoff" value="false" />
<entry key="capabilityCondition.frozen" value="false" />
<entry key="capabilityCondition.closed" value="false" />
</map>
</property>
<property name="group"><ref bean="folderControlGroup" /></property>
<property name="index" value="50" />
</bean>
<!-- Unassignable --> <!-- Unassignable -->
<bean id="rmCreateRecordFolderCapability" <bean id="rmCreateRecordFolderCapability"

View File

@@ -23,6 +23,7 @@ capability.CreateModifyDestroyFolders.title=Create Modify Destroy Folders
capability.CloseFolders.title=Close Folders capability.CloseFolders.title=Close Folders
capability.ReOpenFolders.title=Re-Open Folders capability.ReOpenFolders.title=Re-Open Folders
capability.DeclareRecordsInClosedFolders.title=Complete Records in Closed Folders capability.DeclareRecordsInClosedFolders.title=Complete Records in Closed Folders
capability.FileVersionRecords.title=File Version Records
# Vital Records # Vital Records
capability.group.vitalRecords.title=Vital Records capability.group.vitalRecords.title=Vital Records

View File

@@ -28,6 +28,7 @@
<includePermissionGroup type="rma:filePlanComponent" permissionGroup="CloseFolders"/> <includePermissionGroup type="rma:filePlanComponent" permissionGroup="CloseFolders"/>
<includePermissionGroup type="rma:filePlanComponent" permissionGroup="DeclareRecordsInClosedFolders"/> <includePermissionGroup type="rma:filePlanComponent" permissionGroup="DeclareRecordsInClosedFolders"/>
<includePermissionGroup type="rma:filePlanComponent" permissionGroup="ReOpenFolders"/> <includePermissionGroup type="rma:filePlanComponent" permissionGroup="ReOpenFolders"/>
<includePermissionGroup type="rma:filePlanComponent" permissionGroup="FileVersionRecords" />
<includePermissionGroup type="rma:filePlanComponent" permissionGroup="CycleVitalRecords"/> <includePermissionGroup type="rma:filePlanComponent" permissionGroup="CycleVitalRecords"/>
<includePermissionGroup type="rma:filePlanComponent" permissionGroup="PlanningReviewCycles"/> <includePermissionGroup type="rma:filePlanComponent" permissionGroup="PlanningReviewCycles"/>
<includePermissionGroup type="rma:filePlanComponent" permissionGroup="UpdateTriggerDates"/> <includePermissionGroup type="rma:filePlanComponent" permissionGroup="UpdateTriggerDates"/>
@@ -114,7 +115,8 @@
<permissionGroup name="AddModifyEventDates" expose="false" allowFullControl="false"/> <permissionGroup name="AddModifyEventDates" expose="false" allowFullControl="false"/>
<permissionGroup name="CloseFolders" expose="false" allowFullControl="false"/> <permissionGroup name="CloseFolders" expose="false" allowFullControl="false"/>
<permissionGroup name="DeclareRecordsInClosedFolders" expose="false" allowFullControl="false"/> <permissionGroup name="DeclareRecordsInClosedFolders" expose="false" allowFullControl="false"/>
<permissionGroup name="ReOpenFolders" expose="false" allowFullControl="false"/> <permissionGroup name="FileVersionRecords" expose="false" allowFullControl="false"/>
<permissionGroup name="ReOpenFolders" expose="false" allowFullControl="false" />
<permissionGroup name="CycleVitalRecords" expose="false" allowFullControl="false"/> <permissionGroup name="CycleVitalRecords" expose="false" allowFullControl="false"/>
<permissionGroup name="PlanningReviewCycles" expose="false" allowFullControl="false"/> <permissionGroup name="PlanningReviewCycles" expose="false" allowFullControl="false"/>
<permissionGroup name="UpdateTriggerDates" expose="false" allowFullControl="false"/> <permissionGroup name="UpdateTriggerDates" expose="false" allowFullControl="false"/>
@@ -232,6 +234,10 @@
<grantedToGroup permissionGroup="ReOpenFolders"/> <grantedToGroup permissionGroup="ReOpenFolders"/>
</permission> </permission>
<permission name="_FileVersionRecords" expose="false">
<grantedToGroup permissionGroup="FileVersionRecords" />
</permission>
<permission name="_CycleVitalRecords" expose="false"> <permission name="_CycleVitalRecords" expose="false">
<grantedToGroup permissionGroup="CycleVitalRecords"/> <grantedToGroup permissionGroup="CycleVitalRecords"/>
</permission> </permission>

View File

@@ -49,7 +49,8 @@
"RequestRecordInformation", "RequestRecordInformation",
"FileUnfiledRecords", "FileUnfiledRecords",
"RejectRecords", "RejectRecords",
"LinkToRecords" "LinkToRecords",
"FileVersionRecords"
] ]
}, },
{ {
@@ -74,7 +75,8 @@
"FileUnfiledRecords", "FileUnfiledRecords",
"RejectRecords", "RejectRecords",
"LinkToRecords", "LinkToRecords",
"ManageAccessControls" "ManageAccessControls",
"FileVersionRecords"
] ]
}, },
{ {
@@ -145,8 +147,8 @@
"DeleteHold", "DeleteHold",
"EndRetention", "EndRetention",
"EditHold", "EditHold",
"ManageAccessControls" "ManageAccessControls",
"FileVersionRecords"
] ]
}, },
{ {
@@ -219,7 +221,8 @@
"FileHoldReport", "FileHoldReport",
"DeleteHold", "DeleteHold",
"EditHold", "EditHold",
"EndRetention" "EndRetention",
"FileVersionRecords"
] ]
} }
] ]

View File

@@ -27,6 +27,8 @@
package org.alfresco.module.org_alfresco_module_rm.action.dm; package org.alfresco.module.org_alfresco_module_rm.action.dm;
import static org.alfresco.module.org_alfresco_module_rm.action.dm.RecordActionUtils.resolvePath;
import java.util.List; import java.util.List;
import org.alfresco.module.org_alfresco_module_rm.action.AuditableActionExecuterAbstractBase; import org.alfresco.module.org_alfresco_module_rm.action.AuditableActionExecuterAbstractBase;
@@ -128,13 +130,13 @@ public class CreateRecordAction extends AuditableActionExecuterAbstractBase
Boolean hideRecordValue = ((Boolean) action.getParameterValue(PARAM_HIDE_RECORD)); Boolean hideRecordValue = ((Boolean) action.getParameterValue(PARAM_HIDE_RECORD));
if (hideRecordValue != null) if (hideRecordValue != null)
{ {
hideRecord = hideRecordValue.booleanValue(); hideRecord = hideRecordValue;
} }
if (pathParameter != null && !pathParameter.isEmpty()) if (pathParameter != null && !pathParameter.isEmpty())
{ {
RecordActionUtils.Services services = new Services(nodeService, filePlanService, authenticationUtil); RecordActionUtils.Services services = new Services(nodeService, filePlanService, authenticationUtil);
destinationRecordFolder = RecordActionUtils.resolvePath(services, filePlan, pathParameter, NAME); destinationRecordFolder = resolvePath(services, filePlan, pathParameter, NAME);
} }
synchronized (this) synchronized (this)

View File

@@ -74,7 +74,7 @@ public class DeclareAsVersionRecordAction extends AuditableActionExecuterAbstrac
public static final String PARAM_FILE_PLAN = "file-plan"; public static final String PARAM_FILE_PLAN = "file-plan";
public static final String PARAM_PATH = "path"; public static final String PARAM_PATH = "path";
private static final String EDIT_RECORD_METADATA_CAPABILITY = "EditRecordMetadata"; private static final String FILE_VERSION_RECORDS_CAPABILITY = "FileVersionRecords";
/** Sync Model URI */ /** Sync Model URI */
private static final String SYNC_MODEL_1_0_URI = "http://www.alfresco.org/model/sync/1.0"; private static final String SYNC_MODEL_1_0_URI = "http://www.alfresco.org/model/sync/1.0";
@@ -181,17 +181,15 @@ public class DeclareAsVersionRecordAction extends AuditableActionExecuterAbstrac
logger.debug("Can not declare version as record, because " + actionedUponNodeRef.toString() + " is not a supported type."); logger.debug("Can not declare version as record, because " + actionedUponNodeRef.toString() + " is not a supported type.");
} }
} }
else if (!isActionEligible(actionedUponNodeRef)) else if (isActionEligible(actionedUponNodeRef))
{ {
NodeRef filePlan = (NodeRef)action.getParameterValue(PARAM_FILE_PLAN); NodeRef filePlan = (NodeRef)action.getParameterValue(PARAM_FILE_PLAN);
if (filePlan == null) if (filePlan == null)
{ {
filePlan = RecordActionUtils.getDefaultFilePlan(authenticationUtil, filePlanService, NAME); filePlan = RecordActionUtils.getDefaultFilePlan(authenticationUtil, filePlanService, NAME);
} }
else
{
// verify that the provided file plan is actually a file plan // verify that the provided file plan is actually a file plan
if (!filePlanService.isFilePlan(filePlan)) else if (!filePlanService.isFilePlan(filePlan))
{ {
if (logger.isDebugEnabled()) if (logger.isDebugEnabled())
{ {
@@ -199,7 +197,6 @@ public class DeclareAsVersionRecordAction extends AuditableActionExecuterAbstrac
} }
throw new AlfrescoRuntimeException("Can not declare version record, because the provided file plan node reference is not a file plan."); throw new AlfrescoRuntimeException("Can not declare version record, because the provided file plan node reference is not a file plan.");
} }
}
// resolve destination record folder if path supplied // resolve destination record folder if path supplied
NodeRef destinationRecordFolder = null; NodeRef destinationRecordFolder = null;
@@ -213,7 +210,7 @@ public class DeclareAsVersionRecordAction extends AuditableActionExecuterAbstrac
// create record from latest version // create record from latest version
if (destinationRecordFolder != null) if (destinationRecordFolder != null)
{ {
boolean hasCapability = capabilityService.hasCapability(destinationRecordFolder, EDIT_RECORD_METADATA_CAPABILITY); boolean hasCapability = capabilityService.hasCapability(destinationRecordFolder, FILE_VERSION_RECORDS_CAPABILITY);
// validate destination record folder // validate destination record folder
if (hasCapability) if (hasCapability)
{ {
@@ -261,7 +258,7 @@ public class DeclareAsVersionRecordAction extends AuditableActionExecuterAbstrac
{ {
logger.debug("Can not declare version record, because " + actionedUponNodeRef.toString() + aspect.getValue()); logger.debug("Can not declare version record, because " + actionedUponNodeRef.toString() + aspect.getValue());
} }
return true; return false;
} }
} }
if (!nodeService.hasAspect(actionedUponNodeRef, ContentModel.ASPECT_VERSIONABLE)) if (!nodeService.hasAspect(actionedUponNodeRef, ContentModel.ASPECT_VERSIONABLE))
@@ -270,8 +267,8 @@ public class DeclareAsVersionRecordAction extends AuditableActionExecuterAbstrac
{ {
logger.debug("Can not declare version record, because " + actionedUponNodeRef.toString() + " does not have the versionable aspect applied."); logger.debug("Can not declare version record, because " + actionedUponNodeRef.toString() + " does not have the versionable aspect applied.");
} }
return true;
}
return false; return false;
} }
return true;
}
} }

View File

@@ -37,16 +37,20 @@ import org.alfresco.module.org_alfresco_module_rm.util.AuthenticationUtil;
import org.alfresco.service.cmr.repository.NodeRef; import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.cmr.repository.NodeService; import org.alfresco.service.cmr.repository.NodeService;
import org.alfresco.service.namespace.QName; import org.alfresco.service.namespace.QName;
import org.apache.commons.logging.Log; import org.slf4j.Logger;
import org.apache.commons.logging.LogFactory; import org.slf4j.LoggerFactory;
import org.springframework.util.StringUtils; import org.springframework.util.StringUtils;
/**
* Utility class containing helper methods for record
*/
public class RecordActionUtils public class RecordActionUtils
{ {
/** /**
* Logger * Logger
*/ */
private static final Log LOGGER = LogFactory.getLog(RecordActionUtils.class); private static final Logger LOGGER = LoggerFactory.getLogger(RecordActionUtils.class);
/** Private constructor to prevent instantiation. */ /** Private constructor to prevent instantiation. */
private RecordActionUtils() private RecordActionUtils()
@@ -135,8 +139,6 @@ public class RecordActionUtils
{ {
throw new AlfrescoRuntimeException("Unable to execute " + actionName + " action, because the destination path could not be found."); throw new AlfrescoRuntimeException("Unable to execute " + actionName + " action, because the destination path could not be found.");
} }
else
{
QName nodeType = nodeService.getType(nodeRef); QName nodeType = nodeService.getType(nodeRef);
if (nodeType.equals(RecordsManagementModel.TYPE_HOLD_CONTAINER) || if (nodeType.equals(RecordsManagementModel.TYPE_HOLD_CONTAINER) ||
nodeType.equals(RecordsManagementModel.TYPE_TRANSFER_CONTAINER) || nodeType.equals(RecordsManagementModel.TYPE_TRANSFER_CONTAINER) ||
@@ -144,7 +146,6 @@ public class RecordActionUtils
{ {
throw new AlfrescoRuntimeException("Unable to execute " + actionName + " action, because the destination path is invalid."); throw new AlfrescoRuntimeException("Unable to execute " + actionName + " action, because the destination path is invalid.");
} }
}
if (pathElements.size() > 1) if (pathElements.size() > 1)
{ {
nodeRef = resolvePath(nodeService, nodeRef, pathElements.subList(1, pathElements.size()), actionName); nodeRef = resolvePath(nodeService, nodeRef, pathElements.subList(1, pathElements.size()), actionName);
@@ -164,11 +165,10 @@ public class RecordActionUtils
// if the file plan is still null, raise an exception // if the file plan is still null, raise an exception
if (filePlan == null) if (filePlan == null)
{ {
if (LOGGER.isDebugEnabled()) final String logMessage =
{ String.format("Unable to execute %s action, because the fileplan path could not be determined. Make sure at least one file plan has been created.", actionName);
LOGGER.debug("Unable to execute " + actionName + " action, because the fileplan path could not be determined. Make sure at least one file plan has been created."); LOGGER.debug(logMessage);
} throw new AlfrescoRuntimeException(logMessage);
throw new AlfrescoRuntimeException("Unable to execute " + actionName + " action, because the fileplan path could not be determined.");
} }
return filePlan; return filePlan;
} }

View File

@@ -218,13 +218,7 @@ public class DeclareAsVersionRecordActionUnitTest extends BaseActionUnitTest
public void noFilePlanParameterNoDefaultFilePlan() public void noFilePlanParameterNoDefaultFilePlan()
{ {
// setup // setup
doReturn(true).when(mockedNodeService).exists(actionedUponNodeRef); setupMockedAspects();
doReturn(true).when(mockedDictionaryService).isSubClass(any(QName.class), eq(ContentModel.TYPE_CONTENT));
doReturn(true).when(mockedNodeService).hasAspect(actionedUponNodeRef, ContentModel.ASPECT_VERSIONABLE);
doReturn(false).when(mockedNodeService).hasAspect(actionedUponNodeRef, ASPECT_RECORD);
doReturn(false).when(mockedNodeService).hasAspect(actionedUponNodeRef, ContentModel.ASPECT_WORKING_COPY);
doReturn(false).when(mockedNodeService).hasAspect(actionedUponNodeRef, ASPECT_RECORD_REJECTION_DETAILS);
doReturn(false).when(mockedNodeService).hasAspect(actionedUponNodeRef, ASPECT_SYNCED);
// no default file plan // no default file plan
doReturn(null).when(mockedFilePlanService).getFilePlanBySiteId(FilePlanService.DEFAULT_RM_SITE_ID); doReturn(null).when(mockedFilePlanService).getFilePlanBySiteId(FilePlanService.DEFAULT_RM_SITE_ID);
@@ -246,13 +240,7 @@ public class DeclareAsVersionRecordActionUnitTest extends BaseActionUnitTest
public void noFilePlanParameterDefaultFilePlan() public void noFilePlanParameterDefaultFilePlan()
{ {
// setup // setup
doReturn(true).when(mockedNodeService).exists(actionedUponNodeRef); setupMockedAspects();
doReturn(true).when(mockedDictionaryService).isSubClass(any(QName.class), eq(ContentModel.TYPE_CONTENT));
doReturn(true).when(mockedNodeService).hasAspect(actionedUponNodeRef, ContentModel.ASPECT_VERSIONABLE);
doReturn(false).when(mockedNodeService).hasAspect(actionedUponNodeRef, ASPECT_RECORD);
doReturn(false).when(mockedNodeService).hasAspect(actionedUponNodeRef, ContentModel.ASPECT_WORKING_COPY);
doReturn(false).when(mockedNodeService).hasAspect(actionedUponNodeRef, ASPECT_RECORD_REJECTION_DETAILS);
doReturn(false).when(mockedNodeService).hasAspect(actionedUponNodeRef, ASPECT_SYNCED);
// no default file plan // no default file plan
doReturn(filePlan).when(mockedFilePlanService).getFilePlanBySiteId(FilePlanService.DEFAULT_RM_SITE_ID); doReturn(filePlan).when(mockedFilePlanService).getFilePlanBySiteId(FilePlanService.DEFAULT_RM_SITE_ID);
@@ -272,13 +260,7 @@ public class DeclareAsVersionRecordActionUnitTest extends BaseActionUnitTest
public void invalidFilePlanParameter() public void invalidFilePlanParameter()
{ {
// setup // setup
doReturn(true).when(mockedNodeService).exists(actionedUponNodeRef); setupMockedAspects();
doReturn(true).when(mockedDictionaryService).isSubClass(any(QName.class), eq(ContentModel.TYPE_CONTENT));
doReturn(true).when(mockedNodeService).hasAspect(actionedUponNodeRef, ContentModel.ASPECT_VERSIONABLE);
doReturn(false).when(mockedNodeService).hasAspect(actionedUponNodeRef, ASPECT_RECORD);
doReturn(false).when(mockedNodeService).hasAspect(actionedUponNodeRef, ContentModel.ASPECT_WORKING_COPY);
doReturn(false).when(mockedNodeService).hasAspect(actionedUponNodeRef, ASPECT_RECORD_REJECTION_DETAILS);
doReturn(false).when(mockedNodeService).hasAspect(actionedUponNodeRef, ASPECT_SYNCED);
// not a file plan is provided in the parameters // not a file plan is provided in the parameters
mockActionParameterValue(DeclareAsVersionRecordAction.PARAM_FILE_PLAN, generateNodeRef()); mockActionParameterValue(DeclareAsVersionRecordAction.PARAM_FILE_PLAN, generateNodeRef());
@@ -300,13 +282,7 @@ public class DeclareAsVersionRecordActionUnitTest extends BaseActionUnitTest
public void validFilePlanParameter() public void validFilePlanParameter()
{ {
// setup // setup
doReturn(true).when(mockedNodeService).exists(actionedUponNodeRef); setupMockedAspects();
doReturn(true).when(mockedDictionaryService).isSubClass(any(QName.class), eq(ContentModel.TYPE_CONTENT));
doReturn(true).when(mockedNodeService).hasAspect(actionedUponNodeRef, ContentModel.ASPECT_VERSIONABLE);
doReturn(false).when(mockedNodeService).hasAspect(actionedUponNodeRef, ASPECT_RECORD);
doReturn(false).when(mockedNodeService).hasAspect(actionedUponNodeRef, ContentModel.ASPECT_WORKING_COPY);
doReturn(false).when(mockedNodeService).hasAspect(actionedUponNodeRef, ASPECT_RECORD_REJECTION_DETAILS);
doReturn(false).when(mockedNodeService).hasAspect(actionedUponNodeRef, ASPECT_SYNCED);
// not a file plan is provided in the parameters // not a file plan is provided in the parameters
NodeRef myFilePlan = generateNodeRef(TYPE_FILE_PLAN); NodeRef myFilePlan = generateNodeRef(TYPE_FILE_PLAN);
@@ -326,29 +302,25 @@ public class DeclareAsVersionRecordActionUnitTest extends BaseActionUnitTest
@Test @Test
public void validDestinationRecordFolderProvided() public void validDestinationRecordFolderProvided()
{ {
String childName = GUID.generate(); String pathParameter = GUID.generate();
// setup // setup
doReturn(true).when(mockedNodeService).exists(actionedUponNodeRef); setupMockedAspects();
doReturn(true).when(mockedDictionaryService).isSubClass(any(QName.class), eq(ContentModel.TYPE_CONTENT));
doReturn(true).when(mockedNodeService).hasAspect(actionedUponNodeRef, ContentModel.ASPECT_VERSIONABLE); mockActionParameterValue(DeclareAsVersionRecordAction.PARAM_PATH, pathParameter);
doReturn(false).when(mockedNodeService).hasAspect(actionedUponNodeRef, ASPECT_RECORD);
doReturn(false).when(mockedNodeService).hasAspect(actionedUponNodeRef, ContentModel.ASPECT_WORKING_COPY);
doReturn(false).when(mockedNodeService).hasAspect(actionedUponNodeRef, ASPECT_RECORD_REJECTION_DETAILS);
doReturn(false).when(mockedNodeService).hasAspect(actionedUponNodeRef, ASPECT_SYNCED);
// provided location // provided location
doReturn(destinationRecordFolderNodeRef).when(mockedNodeService).getChildByName(parentDestinationNodeRef, ContentModel.ASSOC_CONTAINS, childName); doReturn(destinationRecordFolderNodeRef).when(mockedNodeService).getChildByName(filePlan, ContentModel.ASSOC_CONTAINS, pathParameter);
doReturn(TYPE_RECORD_FOLDER).when(mockedNodeService).getType(destinationRecordFolderNodeRef); doReturn(TYPE_RECORD_FOLDER).when(mockedNodeService).getType(destinationRecordFolderNodeRef);
// capability check // capability check
doReturn(true).when(mockedCapabilityService).hasCapability(destinationRecordFolderNodeRef, "EditRecordMetadata"); doReturn(true).when(mockedCapabilityService).hasCapability(destinationRecordFolderNodeRef, "FileVersionRecords");
// file plan service // file plan service
doReturn(filePlan).when(mockedFilePlanService).getFilePlanBySiteId(FilePlanService.DEFAULT_RM_SITE_ID); doReturn(filePlan).when(mockedFilePlanService).getFilePlanBySiteId(FilePlanService.DEFAULT_RM_SITE_ID);
// execute action // execute action
declareAsVersionRecordAction.executeImpl(mock(Action.class), actionedUponNodeRef); declareAsVersionRecordAction.executeImpl(getMockedAction(), actionedUponNodeRef);
verify(mockedRecordableVersionService, times(1)).createRecordFromLatestVersion(filePlan, actionedUponNodeRef); verify(mockedRecordableVersionService, times(1)).createRecordFromLatestVersion(destinationRecordFolderNodeRef, actionedUponNodeRef);
} }
/** /**
@@ -361,13 +333,7 @@ public class DeclareAsVersionRecordActionUnitTest extends BaseActionUnitTest
{ {
String childName = GUID.generate(); String childName = GUID.generate();
// setup // setup
doReturn(true).when(mockedNodeService).exists(actionedUponNodeRef); setupMockedAspects();
doReturn(true).when(mockedDictionaryService).isSubClass(any(QName.class), eq(ContentModel.TYPE_CONTENT));
doReturn(true).when(mockedNodeService).hasAspect(actionedUponNodeRef, ContentModel.ASPECT_VERSIONABLE);
doReturn(false).when(mockedNodeService).hasAspect(actionedUponNodeRef, ASPECT_RECORD);
doReturn(false).when(mockedNodeService).hasAspect(actionedUponNodeRef, ContentModel.ASPECT_WORKING_COPY);
doReturn(false).when(mockedNodeService).hasAspect(actionedUponNodeRef, ASPECT_RECORD_REJECTION_DETAILS);
doReturn(false).when(mockedNodeService).hasAspect(actionedUponNodeRef, ASPECT_SYNCED);
// provided location // provided location
doReturn(destinationRecordFolderNodeRef).when(mockedNodeService).getChildByName(parentDestinationNodeRef, ContentModel.ASSOC_CONTAINS, childName); doReturn(destinationRecordFolderNodeRef).when(mockedNodeService).getChildByName(parentDestinationNodeRef, ContentModel.ASSOC_CONTAINS, childName);
@@ -380,6 +346,17 @@ public class DeclareAsVersionRecordActionUnitTest extends BaseActionUnitTest
exception.expect(AlfrescoRuntimeException.class); exception.expect(AlfrescoRuntimeException.class);
// execute action // execute action
declareAsVersionRecordAction.executeImpl(mock(Action.class), actionedUponNodeRef); declareAsVersionRecordAction.executeImpl(getMockedAction(), actionedUponNodeRef);
}
private void setupMockedAspects()
{
doReturn(true).when(mockedNodeService).exists(actionedUponNodeRef);
doReturn(true).when(mockedDictionaryService).isSubClass(any(QName.class), eq(ContentModel.TYPE_CONTENT));
doReturn(true).when(mockedNodeService).hasAspect(actionedUponNodeRef, ContentModel.ASPECT_VERSIONABLE);
doReturn(false).when(mockedNodeService).hasAspect(actionedUponNodeRef, ASPECT_RECORD);
doReturn(false).when(mockedNodeService).hasAspect(actionedUponNodeRef, ContentModel.ASPECT_WORKING_COPY);
doReturn(false).when(mockedNodeService).hasAspect(actionedUponNodeRef, ASPECT_RECORD_REJECTION_DETAILS);
doReturn(false).when(mockedNodeService).hasAspect(actionedUponNodeRef, ASPECT_SYNCED);
} }
} }