Search in sources :

Example 11 with DispositionAction

use of org.alfresco.module.org_alfresco_module_rm.disposition.DispositionAction in project records-management by Alfresco.

the class LastDispositionActionCondition method evaluateImpl.

/**
 * @see org.alfresco.module.org_alfresco_module_rm.capability.declarative.CapabilityCondition#evaluate(org.alfresco.service.cmr.repository.NodeRef)
 */
@Override
public boolean evaluateImpl(NodeRef nodeRef) {
    boolean result = false;
    DispositionAction dispositionAction = dispositionService.getLastCompletedDispostionAction(nodeRef);
    if (dispositionAction != null && dispositionActionName.equals(dispositionAction.getName())) {
        result = true;
    }
    return result;
}
Also used : DispositionAction(org.alfresco.module.org_alfresco_module_rm.disposition.DispositionAction)

Example 12 with DispositionAction

use of org.alfresco.module.org_alfresco_module_rm.disposition.DispositionAction in project records-management by Alfresco.

the class MoveRecordFolderTest method testMoveRecordFolderBeforeCutOffFolderLevelDisposition.

/**
 * Given two categories, both with cut off immediately schedules, when the record is move then all the parts of the
 * record should be correct based on the new schedule.
 *
 * @see https://issues.alfresco.com/jira/browse/RM-1345
 */
public void testMoveRecordFolderBeforeCutOffFolderLevelDisposition() throws Exception {
    doBehaviourDrivenTest(new BehaviourDrivenTest(null, false) {

        NodeRef recordFolder;

        NodeRef destinationRecordCategory;

        public void given() {
            doTestInTransaction(new VoidTest() {

                public void runImpl() throws Exception {
                    NodeRef rcOne = createRecordCategory(false);
                    destinationRecordCategory = createRecordCategory(false);
                    recordFolder = recordFolderService.createRecordFolder(rcOne, GUID.generate());
                    // check for the lifecycle aspect
                    assertTrue(nodeService.hasAspect(recordFolder, ASPECT_DISPOSITION_LIFECYCLE));
                    // check the disposition action details
                    DispositionAction dispositionAction = dispositionService.getNextDispositionAction(recordFolder);
                    assertNotNull(dispositionAction);
                    assertNotNull(CutOffAction.NAME, dispositionAction.getName());
                    assertNotNull(dispositionAction.getAsOfDate());
                    assertTrue(dispositionService.isNextDispositionActionEligible(recordFolder));
                }
            });
            doTestInTransaction(new VoidTest() {

                public void runImpl() throws Exception {
                    // check the search aspect properties
                    assertTrue(nodeService.hasAspect(recordFolder, ASPECT_RM_SEARCH));
                    assertEquals(CutOffAction.NAME, nodeService.getProperty(recordFolder, PROP_RS_DISPOSITION_ACTION_NAME));
                    assertNotNull(nodeService.getProperty(recordFolder, PROP_RS_DISPOSITION_ACTION_AS_OF));
                }
            });
        }

        public void when() throws Exception {
            doTestInTransaction(new VoidTest() {

                public void runImpl() throws Exception {
                    // move record folder
                    fileFolderService.move(recordFolder, destinationRecordCategory, GUID.generate());
                }
            });
        }

        public void then() {
            doTestInTransaction(new VoidTest() {

                public void runImpl() throws Exception {
                    // check for the lifecycle aspect
                    assertTrue(nodeService.hasAspect(recordFolder, ASPECT_DISPOSITION_LIFECYCLE));
                    // check the disposition action details
                    DispositionAction dispositionAction = dispositionService.getNextDispositionAction(recordFolder);
                    assertNotNull(dispositionAction);
                    assertNotNull(CutOffAction.NAME, dispositionAction.getName());
                    assertNotNull(dispositionAction.getAsOfDate());
                    assertTrue(dispositionService.isNextDispositionActionEligible(recordFolder));
                    // check the search aspect properties
                    assertTrue(nodeService.hasAspect(recordFolder, ASPECT_RM_SEARCH));
                    assertEquals(CutOffAction.NAME, nodeService.getProperty(recordFolder, PROP_RS_DISPOSITION_ACTION_NAME));
                    assertNotNull(nodeService.getProperty(recordFolder, PROP_RS_DISPOSITION_ACTION_AS_OF));
                }
            });
        }
    });
}
Also used : NodeRef(org.alfresco.service.cmr.repository.NodeRef) DispositionAction(org.alfresco.module.org_alfresco_module_rm.disposition.DispositionAction)

Example 13 with DispositionAction

use of org.alfresco.module.org_alfresco_module_rm.disposition.DispositionAction in project records-management by Alfresco.

the class MoveRecordFolderTest method testMoveRecordFolderWithRecordsBeforeCutOffRecordLevelDisposition.

/**
 */
public void testMoveRecordFolderWithRecordsBeforeCutOffRecordLevelDisposition() throws Exception {
    doBehaviourDrivenTest(new BehaviourDrivenTest(null, false) {

        NodeRef record;

        NodeRef recordFolder;

        NodeRef destinationRecordCategory;

        public void given() {
            doTestInTransaction(new VoidTest() {

                public void runImpl() throws Exception {
                    NodeRef rcOne = createRecordCategory(true);
                    destinationRecordCategory = createRecordCategory(true);
                    recordFolder = recordFolderService.createRecordFolder(rcOne, GUID.generate());
                    record = utils.createRecord(recordFolder, GUID.generate());
                    // check for the lifecycle aspect
                    assertFalse(nodeService.hasAspect(recordFolder, ASPECT_DISPOSITION_LIFECYCLE));
                    assertTrue(nodeService.hasAspect(record, ASPECT_DISPOSITION_LIFECYCLE));
                    // check the disposition action details
                    assertNull(dispositionService.getNextDispositionAction(recordFolder));
                    DispositionAction dispositionAction = dispositionService.getNextDispositionAction(record);
                    assertNotNull(dispositionAction);
                    assertNotNull(CutOffAction.NAME, dispositionAction.getName());
                    assertNotNull(dispositionAction.getAsOfDate());
                    assertTrue(dispositionService.isNextDispositionActionEligible(record));
                }
            });
            doTestInTransaction(new VoidTest() {

                public void runImpl() throws Exception {
                    // check the search aspect properties
                    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));
                }
            });
        }

        public void when() throws Exception {
            doTestInTransaction(new VoidTest() {

                public void runImpl() throws Exception {
                    // move record folder
                    fileFolderService.move(recordFolder, destinationRecordCategory, GUID.generate());
                }
            });
        }

        public void then() {
            doTestInTransaction(new VoidTest() {

                public void runImpl() throws Exception {
                    // check for the lifecycle aspect
                    assertFalse(nodeService.hasAspect(recordFolder, ASPECT_DISPOSITION_LIFECYCLE));
                    assertTrue(nodeService.hasAspect(record, ASPECT_DISPOSITION_LIFECYCLE));
                    // check the disposition action details
                    assertNull(dispositionService.getNextDispositionAction(recordFolder));
                    DispositionAction dispositionAction = dispositionService.getNextDispositionAction(record);
                    assertNotNull(dispositionAction);
                    assertNotNull(CutOffAction.NAME, dispositionAction.getName());
                    assertNotNull(dispositionAction.getAsOfDate());
                    assertTrue(dispositionService.isNextDispositionActionEligible(record));
                    // check the search aspect properties
                    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));
                }
            });
        }
    });
}
Also used : NodeRef(org.alfresco.service.cmr.repository.NodeRef) DispositionAction(org.alfresco.module.org_alfresco_module_rm.disposition.DispositionAction)

Example 14 with DispositionAction

use of org.alfresco.module.org_alfresco_module_rm.disposition.DispositionAction in project records-management by Alfresco.

the class MoveRecordFolderTest method testMoveRecordFolderBeforeCutOffIntoAFolderWithNoDisposition.

/**
 */
public void testMoveRecordFolderBeforeCutOffIntoAFolderWithNoDisposition() throws Exception {
    doBehaviourDrivenTest(new BehaviourDrivenTest(null, false) {

        NodeRef recordFolder;

        NodeRef destinationRecordCategory;

        public void given() {
            doTestInTransaction(new VoidTest() {

                public void runImpl() throws Exception {
                    NodeRef rcOne = createRecordCategory(false);
                    destinationRecordCategory = filePlanService.createRecordCategory(filePlan, GUID.generate());
                    recordFolder = recordFolderService.createRecordFolder(rcOne, GUID.generate());
                    // check for the lifecycle aspect
                    assertTrue(nodeService.hasAspect(recordFolder, ASPECT_DISPOSITION_LIFECYCLE));
                    // check the disposition action details
                    DispositionAction dispositionAction = dispositionService.getNextDispositionAction(recordFolder);
                    assertNotNull(dispositionAction);
                    assertNotNull(CutOffAction.NAME, dispositionAction.getName());
                    assertNotNull(dispositionAction.getAsOfDate());
                    assertTrue(dispositionService.isNextDispositionActionEligible(recordFolder));
                }
            });
            doTestInTransaction(new VoidTest() {

                public void runImpl() throws Exception {
                    // check the search aspect properties
                    assertTrue(nodeService.hasAspect(recordFolder, ASPECT_RM_SEARCH));
                    assertEquals(CutOffAction.NAME, nodeService.getProperty(recordFolder, PROP_RS_DISPOSITION_ACTION_NAME));
                    assertNotNull(nodeService.getProperty(recordFolder, PROP_RS_DISPOSITION_ACTION_AS_OF));
                }
            });
        }

        public void when() throws Exception {
            doTestInTransaction(new VoidTest() {

                public void runImpl() throws Exception {
                    // move record folder
                    fileFolderService.move(recordFolder, destinationRecordCategory, GUID.generate());
                }
            });
        }

        public void then() {
            doTestInTransaction(new VoidTest() {

                public void runImpl() throws Exception {
                    // check for the lifecycle aspect
                    assertFalse(nodeService.hasAspect(recordFolder, ASPECT_DISPOSITION_LIFECYCLE));
                    // check the disposition action details
                    assertNull(dispositionService.getNextDispositionAction(recordFolder));
                    // check the search aspect properties
                    assertFalse(nodeService.hasAspect(recordFolder, ASPECT_RM_SEARCH));
                }
            });
        }
    });
}
Also used : NodeRef(org.alfresco.service.cmr.repository.NodeRef) DispositionAction(org.alfresco.module.org_alfresco_module_rm.disposition.DispositionAction)

Example 15 with DispositionAction

use of org.alfresco.module.org_alfresco_module_rm.disposition.DispositionAction in project records-management by Alfresco.

the class EditDispositionActionAsOfDateAction method executeImpl.

/**
 * @see org.alfresco.repo.action.executer.ActionExecuterAbstractBase#executeImpl(org.alfresco.service.cmr.action.Action,
 *      org.alfresco.service.cmr.repository.NodeRef)
 */
@Override
protected void executeImpl(Action action, NodeRef actionedUponNodeRef) {
    if (this.getNodeService().hasAspect(actionedUponNodeRef, ASPECT_DISPOSITION_LIFECYCLE)) {
        // Get the action parameter
        Date asOfDate = (Date) action.getParameterValue(PARAM_AS_OF_DATE);
        if (asOfDate == null) {
            throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_VALID_DATE_DISP_ASOF));
        }
        // Set the dispostion action as of date
        DispositionAction da = getDispositionService().getNextDispositionAction(actionedUponNodeRef);
        if (da != null) {
            getNodeService().setProperty(da.getNodeRef(), PROP_DISPOSITION_AS_OF, asOfDate);
            getNodeService().setProperty(da.getNodeRef(), PROP_MANUALLY_SET_AS_OF, true);
        }
    } else {
        throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_DISP_ASOF_LIFECYCLE_APPLIED));
    }
}
Also used : AlfrescoRuntimeException(org.alfresco.error.AlfrescoRuntimeException) Date(java.util.Date) DispositionAction(org.alfresco.module.org_alfresco_module_rm.disposition.DispositionAction)

Aggregations

DispositionAction (org.alfresco.module.org_alfresco_module_rm.disposition.DispositionAction)23 NodeRef (org.alfresco.service.cmr.repository.NodeRef)10 Date (java.util.Date)8 Serializable (java.io.Serializable)6 DispositionActionDefinition (org.alfresco.module.org_alfresco_module_rm.disposition.DispositionActionDefinition)6 QName (org.alfresco.service.namespace.QName)6 HashMap (java.util.HashMap)5 AlfrescoRuntimeException (org.alfresco.error.AlfrescoRuntimeException)4 ArrayList (java.util.ArrayList)2 Map (java.util.Map)2 DispositionSchedule (org.alfresco.module.org_alfresco_module_rm.disposition.DispositionSchedule)2 EventCompletionDetails (org.alfresco.module.org_alfresco_module_rm.event.EventCompletionDetails)2 ChildAssociationRef (org.alfresco.service.cmr.repository.ChildAssociationRef)2 Period (org.alfresco.service.cmr.repository.Period)2 Test (org.junit.Test)2 Capability (org.alfresco.module.org_alfresco_module_rm.capability.Capability)1 DispositionActionImpl (org.alfresco.module.org_alfresco_module_rm.disposition.DispositionActionImpl)1 Behaviour (org.alfresco.repo.policy.annotation.Behaviour)1 AuthenticationUtil (org.alfresco.repo.security.authentication.AuthenticationUtil)1 Action (org.alfresco.service.cmr.action.Action)1