From 001eaa649c466d7c3e51c0366333ed94d3f41014 Mon Sep 17 00:00:00 2001 From: ddraper Date: Mon, 4 Jul 2016 10:52:42 +0100 Subject: [PATCH] Merged 'master'. Conflicts: rm-community/rm-community-share/pom.xml rm-enterprise/rm-enterprise-share/src/main/amp/config/alfresco/site-webscripts/org/alfresco/components/console/classification/security-clearance.get.js --- pom.xml | 691 +++++++++-------- rm-automation/pom.xml | 695 ++++++++---------- rm-community/pom.xml | 56 +- .../messages/action-service.properties | 3 +- rm-community/rm-community-repo/pom.xml | 81 +- .../EditDispositionActionAsOfDateAction.java | 3 + .../disposition/DispositionServiceImpl.java | 7 + .../model/rma/type/RecordFolderType.java | 16 +- .../UpdateNextDispositionActionTest.java | 148 ++++ .../test/util/CommonRMTestUtils.java | 1 + 10 files changed, 910 insertions(+), 791 deletions(-) create mode 100644 rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/disposition/UpdateNextDispositionActionTest.java diff --git a/pom.xml b/pom.xml index cb57c19c48..1bba046707 100644 --- a/pom.xml +++ b/pom.xml @@ -1,346 +1,345 @@ - - - 4.0.0 - org.alfresco - alfresco-rm - pom - 2.5-SNAPSHOT - Alfresco Records Management - - - org.alfresco.maven - alfresco-sdk-parent - 2.1.1 - - - http://www.alfresco.org/ - 2005 - - Alfresco Software - http://www.alfresco.org/ - - - - scm:git:https://gitlab.alfresco.com/records-management/records-management.git - scm:git:https://gitlab.alfresco.com/records-management/records-management.git - https://gitlab.alfresco.com/records-management/records-management - HEAD - - - - JIRA - https://issues.alfresco.com/jira/browse/RM - - - Bamboo - https://bamboo.alfresco.com/bamboo/browse/RM - - - - 3.2.5 - - - - - alfresco-internal - https://artifacts.alfresco.com/nexus/content/groups/private - - - - - - alfresco-public - https://artifacts.alfresco.com/nexus/content/groups/public - - - - - - alfresco-internal - https://artifacts.alfresco.com/nexus/content/repositories/internal-releases/ - - - alfresco-internal-snapshots - https://artifacts.alfresco.com/nexus/content/repositories/internal-snapshots/ - - - - - - - ${alfresco.groupId} - alfresco-platform-distribution - ${alfresco.version} - pom - import - - - org.reflections - reflections - 0.9.10 - - - - - - rm-community - rm-enterprise - rm-automation - - - - ${project.version} - AUTO_SERVER=TRUE;DB_CLOSE_ON_EXIT=FALSE;LOCK_TIMEOUT=10000;MVCC=FALSE;LOCK_MODE=0;IGNORECASE=TRUE - false - 1.7 - 1.8 - UTF-8 - UTF-8 - -Xmx1024m -XX:MaxPermSize=256m -Duser.language=en -Dcom.sun.management.jmxremote - - - true - false - - - - - ${project.artifactId}-${project.version} - - - org.apache.maven.plugins - maven-enforcer-plugin - - - enforce-java - - enforce - - - - - 1.8 - - - - - - - - org.codehaus.mojo - build-helper-maven-plugin - - - regex-properties - - regex-properties - - - - - rm.module.repo.version.min - ${alfresco.version} - (\d+)\.(\d+).* - $1.$2 - false - - - rm.module.version - ${alfresco.rm.version} - (\d+)\.(\d+).* - $1.$2 - false - - - - - - add-test-source - - add-test-source - - - - src/unit-test/java - - - - - - - org.apache.maven.plugins - maven-surefire-plugin - - - **/*UnitTest.java - - - - - - - - maven-compiler-plugin - ${maven.compiler.version} - - ${maven.build.sourceVersion} - ${maven.build.sourceVersion} - - - - default-testCompile - process-test-sources - - testCompile - - - ${maven.build.testSourceVersion} - ${maven.build.testSourceVersion} - - - - - - org.eclipse.m2e - lifecycle-mapping - 1.0.0 - - - - - - org.apache.maven.plugins - maven-enforcer-plugin - [1.0.0,) - - enforce - - - - - - - - - - org.codehaus.mojo - - - build-helper-maven-plugin - - - [1.9.1,) - - - regex-properties - - - - - - - - - - - - org.apache.maven.plugins - maven-enforcer-plugin - ${maven.enforcer.plugin} - - - org.codehaus.mojo - properties-maven-plugin - 1.0-alpha-2 - - - org.apache.maven.plugins - maven-failsafe-plugin - 2.19 - - - org.codehaus.mojo - build-helper-maven-plugin - ${maven.buildhelper.version} - - - org.codehaus.mojo - sql-maven-plugin - 1.5 - - - - - org.apache.maven.plugins - maven-release-plugin - 2.5.3 - - V@{project.version} - - - - - - org.apache.maven.plugins - maven-javadoc-plugin - - -Xdoclint:none - - - - - - org.codehaus.mojo - license-maven-plugin - 1.8 - - - ${license.verbose} - false - false - - - Alfresco Software Limited - ${project.parent.parent.basedir}/license/description.ftl - true - true - - - file:${project.parent.parent.basedir}/license - - - ${license.update.dryrun} - true - true - - - - src - - - - - **/package-info.java - **/*.properties - **/*.css - **/*.xml - **/*.json - **/*.txt - **/*.html - - - - - - first - - update-file-header - - process-sources - - - - - - - + + + 4.0.0 + org.alfresco + alfresco-rm + pom + 2.5-SNAPSHOT + Alfresco Records Management + + + org.alfresco.maven + alfresco-sdk-parent + 2.1.1 + + + http://www.alfresco.org/ + 2005 + + Alfresco Software + http://www.alfresco.org/ + + + + scm:git:https://gitlab.alfresco.com/records-management/records-management.git + scm:git:https://gitlab.alfresco.com/records-management/records-management.git + https://gitlab.alfresco.com/records-management/records-management + HEAD + + + + JIRA + https://issues.alfresco.com/jira/browse/RM + + + Bamboo + https://bamboo.alfresco.com/bamboo/browse/RM + + + + 3.2.5 + + + + + alfresco-internal + https://artifacts.alfresco.com/nexus/content/groups/private + + + + + + alfresco-public + https://artifacts.alfresco.com/nexus/content/groups/public + + + + + + alfresco-internal + https://artifacts.alfresco.com/nexus/content/repositories/internal-releases/ + + + alfresco-internal-snapshots + https://artifacts.alfresco.com/nexus/content/repositories/internal-snapshots/ + + + + + + + ${alfresco.groupId} + alfresco-platform-distribution + ${alfresco.version} + pom + import + + + org.reflections + reflections + 0.9.10 + + + + + + rm-community + rm-enterprise + rm-automation + + + + AUTO_SERVER=TRUE;DB_CLOSE_ON_EXIT=FALSE;LOCK_TIMEOUT=10000;MVCC=FALSE;LOCK_MODE=0;IGNORECASE=TRUE + false + 1.7 + 1.8 + UTF-8 + UTF-8 + -Xmx1024m -XX:MaxPermSize=256m -Duser.language=en -Dcom.sun.management.jmxremote + + + true + false + + + + + ${project.artifactId}-${project.version} + + + org.apache.maven.plugins + maven-enforcer-plugin + + + enforce-java + + enforce + + + + + 1.8 + + + + + + + + org.codehaus.mojo + build-helper-maven-plugin + + + regex-properties + + regex-properties + + + + + rm.module.repo.version.min + ${alfresco.version} + (\d+)\.(\d+).* + $1.$2 + false + + + rm.module.version + ${project.version} + (\d+)\.(\d+).* + $1.$2 + false + + + + + + add-test-source + + add-test-source + + + + src/unit-test/java + + + + + + + org.apache.maven.plugins + maven-surefire-plugin + + + **/*UnitTest.java + + + + + + + + maven-compiler-plugin + ${maven.compiler.version} + + ${maven.build.sourceVersion} + ${maven.build.sourceVersion} + + + + default-testCompile + process-test-sources + + testCompile + + + ${maven.build.testSourceVersion} + ${maven.build.testSourceVersion} + + + + + + org.eclipse.m2e + lifecycle-mapping + 1.0.0 + + + + + + org.apache.maven.plugins + maven-enforcer-plugin + [1.0.0,) + + enforce + + + + + + + + + + org.codehaus.mojo + + + build-helper-maven-plugin + + + [1.9.1,) + + + regex-properties + + + + + + + + + + + + org.apache.maven.plugins + maven-enforcer-plugin + ${maven.enforcer.plugin} + + + org.codehaus.mojo + properties-maven-plugin + 1.0-alpha-2 + + + org.apache.maven.plugins + maven-failsafe-plugin + 2.19 + + + org.codehaus.mojo + build-helper-maven-plugin + ${maven.buildhelper.version} + + + org.codehaus.mojo + sql-maven-plugin + 1.5 + + + + + org.apache.maven.plugins + maven-release-plugin + 2.5.3 + + V@{project.version} + + + + + + org.apache.maven.plugins + maven-javadoc-plugin + + -Xdoclint:none + + + + + + org.codehaus.mojo + license-maven-plugin + 1.8 + + + ${license.verbose} + false + false + + + Alfresco Software Limited + ${project.parent.parent.basedir}/license/description.ftl + true + true + + + file:${project.parent.parent.basedir}/license + + + ${license.update.dryrun} + true + true + + + + src + + + + + **/package-info.java + **/*.properties + **/*.css + **/*.xml + **/*.json + **/*.txt + **/*.html + + + + + + first + + update-file-header + + process-sources + + + + + + + diff --git a/rm-automation/pom.xml b/rm-automation/pom.xml index 0721cea0c4..f4305fe14c 100644 --- a/rm-automation/pom.xml +++ b/rm-automation/pom.xml @@ -1,397 +1,348 @@ - - - - 4.0.0 - alfresco-rm-automation - Alfresco Records Management Automation - - - org.alfresco - alfresco-rm - 2.5-SNAPSHOT - - - - 2.45.0 - 4.0.5.RELEASE - 1.8 - testng.xml - true - - - - - - org.codehaus.mojo - build-helper-maven-plugin - - - add-test-source - - add-test-source - - - - src/unit-test/java - - - - - - - maven-surefire-plugin - - false - - ${project.build.testOutputDirectory}/${suiteXmlFile} - - ${skip.automationtests} - - - - maven-antrun-plugin - - - default-cli - - - Stopping Alfresco... - - - - - - - - - - - - org.codehaus.mojo - license-maven-plugin - - alfresco_enterprise - file:${project.parent.basedir}/license - ${project.parent.basedir}/license/description.ftl - - - - - - - - - org.eclipse.m2e - lifecycle-mapping - 1.0.0 - - - - - - - org.codehaus.mojo - - - license-maven-plugin - - - [1.8,) - - - - update-file-header - - - - - - - - - - - - - - - - - - org.alfresco.test - dataprep - 1.8 - - - org.alfresco.test - alfresco-testng - 1.1 - - - org.alfresco - selenium-grid - 1.8 - - - org.springframework - spring-beans - ${spring.version} - - - org.springframework - spring-core - ${spring.version} - - - org.springframework - spring-context - ${spring.version} - - - org.springframework - spring-tx - ${spring.version} - test - - - org.springframework - spring-test - ${spring.version} - test - - - org.testng - testng - 6.8.8 - - - ru.yandex.qatools.htmlelements - htmlelements-all - 1.15 - - - ru.yandex.qatools.properties - properties-loader - 1.5 - test - - - com.github.tomakehurst - wiremock - 1.56 - - - org.mockito - mockito-all - test - - - - - - install-alfresco - - - - maven-antrun-plugin - - - fetch-installer - generate-test-resources - - run - - - - Recreating database... - drop database if exists alfresco; create database alfresco - Downloading Alfresco installer... - - - - Installing Alfresco... - - - - - - - - - - org.apache.ant - ant-jsch - 1.8.2 - - - postgresql - postgresql - 9.1-901-1.jdbc4 - - - - - maven-dependency-plugin - - - fetch-amps - process-test-resources - - copy - - - - - org.alfresco - alfresco-rm-community-share + + + + 4.0.0 + alfresco-rm-automation + Alfresco Records Management Automation + + + org.alfresco + alfresco-rm + 2.5-SNAPSHOT + + + + 2.45.0 + 4.0.5.RELEASE + 1.8 + testng.xml + true + + + + + + org.codehaus.mojo + build-helper-maven-plugin + + + add-test-source + + add-test-source + + + + src/unit-test/java + + + + + + + maven-surefire-plugin + + false + + ${project.build.testOutputDirectory}/${suiteXmlFile} + + ${skip.automationtests} + + + + maven-antrun-plugin + + + default-cli + + + Stopping Alfresco... + + + + + + + + + + org.codehaus.mojo + license-maven-plugin + + alfresco_enterprise + file:${project.parent.basedir}/license + ${project.parent.basedir}/license/description.ftl + + + + + + + org.eclipse.m2e + lifecycle-mapping + 1.0.0 + + + + + + org.codehaus.mojo + license-maven-plugin + [1.8,) + + update-file-header + + + + + + + + + + + + + + + + + org.alfresco.test + dataprep + 1.8 + + + org.alfresco.test + alfresco-testng + 1.1 + + + org.alfresco + selenium-grid + 1.8 + + + org.springframework + spring-beans + ${spring.version} + + + org.springframework + spring-core + ${spring.version} + + + org.springframework + spring-context + ${spring.version} + + + org.springframework + spring-tx + ${spring.version} + test + + + org.springframework + spring-test + ${spring.version} + test + + + org.testng + testng + 6.8.8 + + + ru.yandex.qatools.htmlelements + htmlelements-all + 1.15 + + + ru.yandex.qatools.properties + properties-loader + 1.5 + test + + + com.github.tomakehurst + wiremock + 1.56 + + + org.mockito + mockito-all + test + + + + + + install-alfresco + + + + maven-antrun-plugin + + + fetch-installer + generate-test-resources + + run + + + + Recreating database... + drop database if exists alfresco; create database alfresco + Downloading Alfresco installer... + + + + Installing Alfresco... + + + + + + + + + + org.apache.ant + ant-jsch + 1.8.2 + + + postgresql + postgresql + 9.1-901-1.jdbc4 + + + + + maven-dependency-plugin + + + fetch-amps + process-test-resources + + copy + + + + + org.alfresco + alfresco-rm-enterprise-share ${project.version} amp org.alfresco - alfresco-rm-enterprise-share + alfresco-rm-enterprise-repo ${project.version} amp - - org.alfresco - alfresco-rm-community-repo - ${project.version} - amp - - - org.alfresco - alfresco-rm-enterprise-repo - ${project.version} - amp - - - ${project.build.directory}/amps - true - - - - - - org.alfresco.maven.plugin - alfresco-maven-plugin - true - - - install-community-repo-amp + + ${project.build.directory}/amps + true + + + + + + org.alfresco.maven.plugin + alfresco-maven-plugin + true + + + install-enterprise-repo-amp install process-test-resources true - ${project.build.directory}/amps/alfresco-rm-community-repo-${project.version}.amp + ${project.build.directory}/amps/alfresco-rm-enterprise-repo-${project.version}.amp ${project.build.directory}/alf-installation/tomcat/webapps/alfresco.war - install-enterprise-repo-amp - - install - - process-test-resources - - true - ${project.build.directory}/amps/alfresco-rm-enterprise-repo-${project.version}.amp - ${project.build.directory}/alf-installation/tomcat/webapps/alfresco.war - - - - install-community-share-amp + install-enterprise-share-amp install process-test-resources true - ${project.build.directory}/amps/alfresco-rm-community-share-${project.version}.amp + ${project.build.directory}/amps/alfresco-rm-enterprise-share-${project.version}.amp ${project.build.directory}/alf-installation/tomcat/webapps/share.war - - - - install-enterprise-share-amp - - install - - process-test-resources - - true - ${project.build.directory}/amps/alfresco-rm-enterprise-share-${project.version}.amp - ${project.build.directory}/alf-installation/tomcat/webapps/share.war - - - - - - - - - run-alfresco - - - - org.jacoco - jacoco-maven-plugin - 0.7.5.201505241946 - - - prepare-jacoco - - prepare-agent - - - - - - org.alfresco.* - - - - - maven-antrun-plugin - - - start-alfresco - process-test-classes - - run - - - - Starting Alfresco... - - - - - - - - - - stop-alfresco - post-integration-test - - run - - - - Stopping Alfresco... - - - - - - - - - - - - - + + + + + + + + + run-alfresco + + + + org.jacoco + jacoco-maven-plugin + 0.7.5.201505241946 + + + prepare-jacoco + + prepare-agent + + + + + + org.alfresco.* + + + + + maven-antrun-plugin + + + start-alfresco + process-test-classes + + run + + + + Starting Alfresco... + + + + + + + + + + stop-alfresco + post-integration-test + + run + + + + Stopping Alfresco... + + + + + + + + + + + + + diff --git a/rm-community/pom.xml b/rm-community/pom.xml index da2908c92c..4f1f270fa3 100644 --- a/rm-community/pom.xml +++ b/rm-community/pom.xml @@ -1,28 +1,28 @@ - - - 4.0.0 - alfresco-rm-community - Alfresco Records Management Community - pom - - - org.alfresco - alfresco-rm - 2.5-SNAPSHOT - - - - - LGPL 3 - - - - - rm-community-repo - rm-community-share - - - - 5.1.e - - + + + 4.0.0 + alfresco-rm-community + Alfresco Records Management Community + pom + + + org.alfresco + alfresco-rm + 2.5-SNAPSHOT + + + + + LGPL 3 + + + + + rm-community-repo + rm-community-share + + + + 5.1.e + + diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/action-service.properties b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/action-service.properties index 5c6a7d4daf..dbb53e0559 100644 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/action-service.properties +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/messages/action-service.properties @@ -36,4 +36,5 @@ rm.action.records_only_undeclared=Only records can be completed. rm.action.event-not-undone=The event {0} can't be undone, because it's not defined on the disposition lifecycle. rm.action.node-not-record-category=The disposition schedule could not be created, because the actioned upon node ({0}) was not a record category. rm.action.parameter-not-supplied=The parameter ''{0}'' has not been supplied. -rm.action.delete-not-hold-type=The hold couldn't be deleted, because the node isn't of type {0}. (actionedUponNodeRef={1}) \ No newline at end of file +rm.action.delete-not-hold-type=The hold couldn't be deleted, because the node isn't of type {0}. (actionedUponNodeRef={1}) +rm.action.record-folder-create=Operation failed, because you can't place a record folder into another record folder. diff --git a/rm-community/rm-community-repo/pom.xml b/rm-community/rm-community-repo/pom.xml index d55da9e478..a4123f6651 100644 --- a/rm-community/rm-community-repo/pom.xml +++ b/rm-community/rm-community-repo/pom.xml @@ -3,13 +3,13 @@ 4.0.0 alfresco-rm-community-repo Alfresco Records Management Community Repo - Alfresco Record Management Core Repository Extension + Alfresco Record Management Community Repository Extension amp org.alfresco alfresco-rm-community - 2.5-SNAPSHOT + 2.5-SNAPSHOT @@ -83,10 +83,10 @@ - + - - + + @@ -110,7 +110,7 @@ - + org.apache.maven.plugins maven-surefire-plugin @@ -205,24 +205,21 @@ - - - - org.codehaus.mojo - license-maven-plugin - - alfresco_community - - source/java - unit-test/java - source/compatibility - config - test/java - test/resources - - - - + + org.codehaus.mojo + license-maven-plugin + + alfresco_community + + source/java + unit-test/java + source/compatibility + config + test/java + test/resources + + + @@ -246,17 +243,17 @@ - - org.codehaus.mojo - license-maven-plugin - [1.8,) - - update-file-header - - - - - + + org.codehaus.mojo + license-maven-plugin + [1.8,) + + update-file-header + + + + + @@ -298,8 +295,8 @@ spring-test 2.5 test - - + + ${alfresco.groupId} alfresco-repository ${alfresco.version} @@ -337,11 +334,11 @@ test - - org.reflections - reflections - test - + + org.reflections + reflections + test + diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/EditDispositionActionAsOfDateAction.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/EditDispositionActionAsOfDateAction.java index d7ff27e995..071b3a2da2 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/EditDispositionActionAsOfDateAction.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/EditDispositionActionAsOfDateAction.java @@ -47,6 +47,9 @@ public class EditDispositionActionAsOfDateAction extends RMActionExecuterAbstrac private static final String MSG_VALID_DATE_DISP_ASOF = "rm.action.valid-date-disp-asof"; private static final String MSG_DISP_ASOF_LIFECYCLE_APPLIED = "rm.action.disp-asof-lifecycle-applied"; + /** Action name */ + public static final String NAME = "editDispositionActionAsOfDate"; + /** Action parameters */ public static final String PARAM_AS_OF_DATE = "asOfDate"; diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/disposition/DispositionServiceImpl.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/disposition/DispositionServiceImpl.java index 95f0aae459..04455015dd 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/disposition/DispositionServiceImpl.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/disposition/DispositionServiceImpl.java @@ -889,6 +889,13 @@ public class DispositionServiceImpl extends ServiceBaseImpl // Get the current action String currentADId = (String) nodeService.getProperty(currentDispositionAction, PROP_DISPOSITION_ACTION_ID); currentDispositionActionDefinition = di.getDispositionActionDefinition(currentADId); + // When the record has multiple disposition schedules the current disposition action may not be found by id + // In this case it will be searched by name + if(currentDispositionActionDefinition == null) + { + String currentADName = (String) nodeService.getProperty(currentDispositionAction, PROP_DISPOSITION_ACTION); + currentDispositionActionDefinition = di.getDispositionActionDefinitionByName(currentADName); + } // Get the next disposition action int index = currentDispositionActionDefinition.getIndex(); diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/type/RecordFolderType.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/type/RecordFolderType.java index 6c3aaafc87..5974c922a6 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/type/RecordFolderType.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/type/RecordFolderType.java @@ -31,6 +31,7 @@ import java.io.Serializable; import java.util.Map; import org.alfresco.error.AlfrescoRuntimeException; +import org.alfresco.model.ContentModel; import org.alfresco.module.org_alfresco_module_rm.model.behaviour.AbstractDisposableItem; import org.alfresco.module.org_alfresco_module_rm.record.RecordService; import org.alfresco.module.org_alfresco_module_rm.recordfolder.RecordFolderService; @@ -49,6 +50,7 @@ import org.alfresco.service.cmr.repository.ChildAssociationRef; import org.alfresco.service.cmr.repository.NodeRef; import org.alfresco.service.namespace.QName; import org.apache.commons.lang.ArrayUtils; +import org.springframework.extensions.surf.util.I18NUtil; /** * rma:recordFolder behaviour bean @@ -73,6 +75,9 @@ public class RecordFolderType extends AbstractDisposableItem /** vital record service */ protected VitalRecordService vitalRecordService; + /** I18N */ + private static final String MSG_CANNOT_CREATE_RECORD_FOLDER = "rm.action.record-folder-create"; + /** * @param recordService record service */ @@ -211,12 +216,13 @@ public class RecordFolderType extends AbstractDisposableItem public void onCreateChildAssociation(ChildAssociationRef childAssocRef, boolean bNew) { NodeRef nodeRef = childAssocRef.getChildRef(); - if (nodeService.exists(nodeRef) && instanceOf(nodeRef, TYPE_RECORD_FOLDER)) + + if (nodeService.exists(nodeRef)) { // ensure nothing is being added to a closed record folder NodeRef recordFolder = childAssocRef.getParentRef(); Boolean isClosed = (Boolean) nodeService.getProperty(recordFolder, PROP_IS_CLOSED); - if (isClosed != null && Boolean.TRUE.equals(isClosed)) + if (isClosed != null && isClosed) { throw new AlfrescoRuntimeException("You can't add new items to a closed record folder."); } @@ -238,6 +244,12 @@ public class RecordFolderType extends AbstractDisposableItem { final NodeRef recordFolder = childAssocRef.getChildRef(); + // only records can be added in a record folder or hidden folders(is the case of e-mail attachments) + if (!instanceOf(recordFolder, ContentModel.TYPE_CONTENT) && !nodeService.hasAspect(recordFolder, ContentModel.ASPECT_HIDDEN)) + { + throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_CANNOT_CREATE_RECORD_FOLDER)); + } + behaviourFilter.disableBehaviour(); try { diff --git a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/disposition/UpdateNextDispositionActionTest.java b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/disposition/UpdateNextDispositionActionTest.java new file mode 100644 index 0000000000..462198f5a7 --- /dev/null +++ b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/disposition/UpdateNextDispositionActionTest.java @@ -0,0 +1,148 @@ +/* + * #%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 . + * #L% + */ +package org.alfresco.module.org_alfresco_module_rm.test.integration.disposition; + +import static org.alfresco.module.org_alfresco_module_rm.test.util.CommonRMTestUtils.DEFAULT_DISPOSITION_DESCRIPTION; +import static org.alfresco.module.org_alfresco_module_rm.test.util.CommonRMTestUtils.DEFAULT_DISPOSITION_INSTRUCTIONS; +import static org.alfresco.module.org_alfresco_module_rm.test.util.CommonRMTestUtils.DEFAULT_EVENT_NAME; +import static org.alfresco.module.org_alfresco_module_rm.test.util.CommonRMTestUtils.PERIOD_ONE_WEEK; +import static org.alfresco.util.GUID.generate; + +import java.io.Serializable; +import java.util.Collections; +import java.util.Date; +import java.util.HashMap; +import java.util.Map; + +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.action.impl.EditDispositionActionAsOfDateAction; +import org.alfresco.module.org_alfresco_module_rm.action.impl.TransferAction; +import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionSchedule; +import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.namespace.QName; + +/** +* Update next disposition step integration tests. +* +* @author Roxana Lucanu +* @since 2.4.1 +*/ +public class UpdateNextDispositionActionTest extends BaseRMTestCase +{ + /** + * Given a record with multiple dispositions + * When updating the next step + * Then the action is available + *

+ * relates to https://issues.alfresco.com/jira/browse/RM-3060 + */ + public void testUpdateNextDispositionAction_RM3060() throws Exception + { + doBehaviourDrivenTest(new BehaviourDrivenTest() + { + NodeRef record; + NodeRef folder2; + + @Override + public void given() + { + // create category1 + NodeRef category1 = filePlanService.createRecordCategory(filePlan, generate()); + + // create disposition schedule for category1 + createDispositionSchedule(category1); + + // create category2 + NodeRef category2 = filePlanService.createRecordCategory(filePlan, generate()); + + // create disposition schedule for category2 + createDispositionSchedule(category2); + + // create folder2 inside category2 + folder2 = recordFolderService.createRecordFolder(category2, generate()); + + // create folder1 inside category1 + NodeRef folder1 = recordFolderService.createRecordFolder(category1, generate()); + + // create record inside folder1 + record = utils.createRecord(folder1, generate(), generate()); + + } + @Override + public void when() throws Exception + { + // link the record to folder2 + recordService.link(record, folder2); + + // complete record + utils.completeRecord(record); + + // set the disposition as of date to now on the record + rmActionService.executeRecordsManagementAction(record, + EditDispositionActionAsOfDateAction.NAME, + Collections.singletonMap(EditDispositionActionAsOfDateAction.PARAM_AS_OF_DATE, new Date())); + + // cut off + rmActionService.executeRecordsManagementAction(record, CutOffAction.NAME, null); + } + + @Override + public void then() throws Exception + { + assertTrue(nodeService.hasAspect(record, ASPECT_CUT_OFF)); + } + }); + } + + private void createDispositionSchedule(NodeRef category) + { + DispositionSchedule ds = utils.createDispositionSchedule(category, DEFAULT_DISPOSITION_INSTRUCTIONS, DEFAULT_DISPOSITION_DESCRIPTION, true, false, false); + + // create the properties for CUTOFF action and add it to the disposition action definition + Map cutOff = new HashMap(3); + cutOff.put(PROP_DISPOSITION_ACTION_NAME, CutOffAction.NAME); + cutOff.put(PROP_DISPOSITION_DESCRIPTION, generate()); + cutOff.put(PROP_DISPOSITION_PERIOD, PERIOD_ONE_WEEK); + dispositionService.addDispositionActionDefinition(ds, cutOff); + + // create the properties for TRANSFER action and add it to the disposition action definition + Map transfer = new HashMap(3); + transfer.put(PROP_DISPOSITION_ACTION_NAME, TransferAction.NAME); + transfer.put(PROP_DISPOSITION_DESCRIPTION, generate()); + transfer.put(PROP_DISPOSITION_EVENT, (Serializable)Collections.singletonList(DEFAULT_EVENT_NAME)); + dispositionService.addDispositionActionDefinition(ds, transfer); + + // create the properties for DESTROY action and add it to the disposition action definition + Map destroy = new HashMap(3); + destroy.put(PROP_DISPOSITION_ACTION_NAME, DestroyAction.NAME); + destroy.put(PROP_DISPOSITION_DESCRIPTION, generate()); + destroy.put(PROP_DISPOSITION_PERIOD, PERIOD_ONE_WEEK); + dispositionService.addDispositionActionDefinition(ds, destroy); + } +} \ No newline at end of file diff --git a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/util/CommonRMTestUtils.java b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/util/CommonRMTestUtils.java index 8f4ddd7969..1938535988 100644 --- a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/util/CommonRMTestUtils.java +++ b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/util/CommonRMTestUtils.java @@ -86,6 +86,7 @@ public class CommonRMTestUtils implements RecordsManagementModel public static final String DEFAULT_EVENT_NAME = "case_closed"; 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"; /** * Constructor