From 575491c2a091a6b52dfc52781f0a18f40c8200c5 Mon Sep 17 00:00:00 2001 From: David Webster Date: Mon, 25 Apr 2016 09:39:44 +0100 Subject: [PATCH 1/5] Version bump to 2.4.0.1-SNAPSHOT for hot fix branch --- pom.xml | 2 +- rm-automation/pom.xml | 2 +- rm-community/pom.xml | 2 +- rm-community/rm-community-repo/pom.xml | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/pom.xml b/pom.xml index 293caa8b57..5103d758ef 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ org.alfresco alfresco-rm pom - 2.4.1-SNAPSHOT + 2.4.0.1-SNAPSHOT Alfresco Records Management diff --git a/rm-automation/pom.xml b/rm-automation/pom.xml index 0001b8d226..b794a5e350 100644 --- a/rm-automation/pom.xml +++ b/rm-automation/pom.xml @@ -8,7 +8,7 @@ org.alfresco alfresco-rm - 2.4.1-SNAPSHOT + 2.4.0.1-SNAPSHOT diff --git a/rm-community/pom.xml b/rm-community/pom.xml index 1653aa3cd3..75623a5acc 100644 --- a/rm-community/pom.xml +++ b/rm-community/pom.xml @@ -8,7 +8,7 @@ org.alfresco alfresco-rm - 2.4.1-SNAPSHOT + 2.4.0.1-SNAPSHOT diff --git a/rm-community/rm-community-repo/pom.xml b/rm-community/rm-community-repo/pom.xml index 8558f5cefd..1d6437cf4d 100644 --- a/rm-community/rm-community-repo/pom.xml +++ b/rm-community/rm-community-repo/pom.xml @@ -8,7 +8,7 @@ org.alfresco alfresco-rm-community - 2.4.1-SNAPSHOT + 2.4.0.1-SNAPSHOT From 5b8a4b02cace7bfe9bd4da98ef509556b6137b0e Mon Sep 17 00:00:00 2001 From: Tuna Aksoy Date: Mon, 23 May 2016 12:03:00 +0100 Subject: [PATCH 2/5] RM-3426 (Number of artifacts for the RM Enterprise project - Update configuration) --- rm-automation/pom.xml | 126 +-- rm-community/rm-community-repo/pom.xml | 1232 ++++++++++++------------ 2 files changed, 648 insertions(+), 710 deletions(-) diff --git a/rm-automation/pom.xml b/rm-automation/pom.xml index 41c9d677c7..d6e74437ce 100644 --- a/rm-automation/pom.xml +++ b/rm-automation/pom.xml @@ -12,13 +12,11 @@ - 2.45.0 4.0.5.RELEASE 1.8 testng.xml true - @@ -28,15 +26,15 @@ build-helper-maven-plugin - add-test-source - - add-test-source - - - - src/unit-test/java - - + add-test-source + + add-test-source + + + + src/unit-test/java + + @@ -66,55 +64,43 @@ - - org.codehaus.mojo - license-maven-plugin - + 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.eclipse.m2e + lifecycle-mapping + 1.0.0 + + + + + + org.codehaus.mojo + license-maven-plugin + [1.8,) + + update-file-header + + + + + + + + + + + @@ -243,24 +229,12 @@ - - org.alfresco - alfresco-rm-community-share - ${project.version} - amp - org.alfresco alfresco-rm-enterprise-share ${project.version} amp - - org.alfresco - alfresco-rm-community-repo - ${project.version} - amp - org.alfresco alfresco-rm-enterprise-repo @@ -279,18 +253,6 @@ alfresco-maven-plugin true - - install-community-repo-amp - - install - - process-test-resources - - true - ${project.build.directory}/amps/alfresco-rm-community-repo-${project.version}.amp - ${project.build.directory}/alf-installation/tomcat/webapps/alfresco.war - - install-enterprise-repo-amp @@ -303,18 +265,6 @@ ${project.build.directory}/alf-installation/tomcat/webapps/alfresco.war - - install-community-share-amp - - install - - process-test-resources - - true - ${project.build.directory}/amps/alfresco-rm-community-share-${project.version}.amp - ${project.build.directory}/alf-installation/tomcat/webapps/share.war - - install-enterprise-share-amp diff --git a/rm-community/rm-community-repo/pom.xml b/rm-community/rm-community-repo/pom.xml index bc53ec5714..422f22ca0b 100644 --- a/rm-community/rm-community-repo/pom.xml +++ b/rm-community/rm-community-repo/pom.xml @@ -1,622 +1,610 @@ - - - 4.0.0 - alfresco-rm-community-repo - Alfresco Records Management Community Repo - Alfresco Record Management Core Repository Extension - amp - - - org.alfresco - alfresco-rm-community - 2.4.1-SNAPSHOT - - - - ${basedir}/target/alf_test_data - org.hibernate.dialect.H2Dialect - alfresco - alfresco - alfresco - localhost - alfresco - 9.1-901.jdbc4 - 5.1.31 - alfresco-rm-community-repo - true - ${project.build.directory}/solr/home - - - - source/java - test/java - - - config - ${app.filtering.enabled} - - - - - unit-test/resources - - - test/resources - - - - - org.codehaus.mojo - build-helper-maven-plugin - - - add-source - - add-source - - - - source/compatibility - - - - - add-test-source - - add-test-source - - - - unit-test/java - - - - - - - maven-antrun-plugin - - - prepare-package - - run - - - - - - - - - - - - - - org.codehaus.mojo - properties-maven-plugin - - - initialize - - read-project-properties - - - - ${basedir}/src/main/resources/local.properties - - true - - - - - - org.apache.maven.plugins - maven-surefire-plugin - - - **/AllUnitTestSuite.class - - - - - org.apache.maven.plugins - maven-failsafe-plugin - - - integration-tests - - integration-test - verify - - - ${skip.integrationtests} - - **/AllTestSuite.class - - - - - - - org.apache.maven.plugins - maven-dependency-plugin - - - unpack-alfresco - prepare-package - - unpack - - - ${app.amp.client.war.folder} - - - ${alfresco.groupId} - ${app.amp.client.war.artifactId} - war - ${alfresco.version} - - - - - - - - org.alfresco.maven.plugin - alfresco-maven-plugin - - - attach-rm-jar - - amp - - - true - true - - - - install-rm-amp - - install - - package - - true - ${project.build.directory}/${alfresco.rm.artifactId}-${alfresco.rm.version}.amp - - - - amps-to-war-overlay - package - - install - - - - - - org.apache.maven.plugins - maven-jar-plugin - - - - test-jar - - - - - - **/alfresco-global.properties - - - - - - - org.codehaus.mojo - license-maven-plugin - - alfresco_community - - source/java - unit-test/java - source/compatibility - config - test/java - test/resources - - - - - - - - - org.eclipse.m2e - lifecycle-mapping - - - - - - org.codehaus.mojo - properties-maven-plugin - [1.0-alpha-2,) - - read-project-properties - - - - - - - - - org.codehaus.mojo - - license-maven-plugin - - [1.8,) - - update-file-header - - - - - - - - - - - - - - - - - ${alfresco.groupId} - alfresco-remote-api - - - io.takari.junit - takari-cpsuite - 1.2.7 - test - - - junit - junit - test - - - org.springframework.extensions.surf - spring-webscripts - tests - test - - - org.mockito - mockito-all - test - - - org.springframework - spring-test - 2.5 - test - - - ${alfresco.groupId} - alfresco-repository - ${alfresco.version} - tests - test - - - ${alfresco.groupId} - alfresco-remote-api - ${alfresco.version} - tests - test - - - postgresql - postgresql - ${alfresco.postgres.version} - test - - - mysql - mysql-connector-java - test - - - ${alfresco.groupId} - alfresco-repository - ${alfresco.version} - h2scripts - - - * - * - - - test - - - - - - use-mysql - - ${my.db.name} - ${my.db.port} - org.hibernate.dialect.MySQLInnoDBDialect - - jdbc:mysql://${alfresco.db.host}:${alfresco.db.port}/${alfresco.db.name} - jdbc:mysql://${alfresco.db.host}:${alfresco.db.port}/${alfresco.db.name} - org.gjt.mm.mysql.Driver - - - - use-postgres - - ${my.db.name} - ${my.db.port} - org.hibernate.dialect.PostgreSQLDialect - - jdbc:postgresql:template1 - jdbc:postgresql:${alfresco.db.name} - org.postgresql.Driver - - - - start-repo - - - - org.apache.maven.plugins - maven-dependency-plugin - - - unpack-alfresco - prepare-package - - unpack - - - ${app.amp.client.war.folder} - - - ${alfresco.groupId} - ${alfresco.repo.artifactId} - war - ${alfresco.version} - - - - - - unpack-alfresco-config - - unpack - - generate-resources - - ${alfresco.solr.home} - - - alfresco-solr4 - ${alfresco.groupId} - config - ${alfresco.version} - zip - - - - - - - - org.alfresco.maven.plugin - alfresco-maven-plugin - - - amps-to-war-overlay - package - - install - - - - - false - - - - org.codehaus.mojo - build-helper-maven-plugin - - - regex-property - generate-resources - - regex-property - - - solrHomePath - ${alfresco.solr.home} - \\ - \\\\ - false - - - - - - com.google.code.maven-replacer-plugin - replacer - - - setup-solr-config - generate-resources - - replace - - - - - false - - ${alfresco.solr.home}/context.xml - ${alfresco.solr.home}/archive-SpacesStore/conf/solrcore.properties - ${alfresco.solr.home}/workspace-SpacesStore/conf/solrcore.properties - ${app.amp.client.war.folder}/WEB-INF/web.xml - - - - @@ALFRESCO_SOLR4_DIR@@ - ${solrHomePath}/ - - - @@ALFRESCO_SOLR4_MODEL_DIR@@ - ${solrHomePath}/alfrescoModels/ - - - @@ALFRESCO_SOLR4_CONTENT_DIR@@ - ${solrHomePath}/data/content/ - - - @@ALFRESCO_SOLR4_DATA_DIR@@ - ${solrHomePath}/data/index/ - - - ]]> - - - - ]]> - ]]> - - - - - - org.apache.tomcat.maven - tomcat7-maven-plugin - - - run-embedded - - run - - integration-test - - false - true - true - - ${project.build.directory} - - false - ${project.basedir}/tomcat/context.xml - - - ${alfresco.groupId} - alfresco-solr4 - ${alfresco.version} - war - true - /solr4 - ${alfresco.solr.home}/context.xml - - - - - - - - postgresql - postgresql - ${alfresco.postgres.version} - - - mysql - mysql-connector-java - ${alfresco.mysql.version} - - - ${alfresco.groupId} - alfresco-repository - ${alfresco.version} - h2scripts - - - * - * - - - - - - - - - - - wipeDB - - - - org.codehaus.mojo - sql-maven-plugin - - true - ${alfresco.db.datasource.class} - ${alfresco.db.master.url} - ${alfresco.db.username} - ${alfresco.db.password} - - - - postgresql - postgresql - ${alfresco.postgres.version} - - - mysql - mysql-connector-java - ${alfresco.mysql.version} - - - - - wipe-database - process-test-resources - - execute - - - drop database if exists alfresco - - - - create-database - process-test-resources - - execute - - - create database alfresco - - - - - - - - - + + + 4.0.0 + alfresco-rm-community-repo + Alfresco Records Management Community Repo + Alfresco Record Management Community Repository Extension + amp + + + org.alfresco + alfresco-rm-community + 2.4.1-SNAPSHOT + + + + ${basedir}/target/alf_test_data + org.hibernate.dialect.H2Dialect + alfresco + alfresco + alfresco + localhost + alfresco + 9.1-901.jdbc4 + 5.1.31 + alfresco-rm-community-repo + true + ${project.build.directory}/solr/home + + + + source/java + test/java + + + config + ${app.filtering.enabled} + + + + + unit-test/resources + + + test/resources + + + + + org.codehaus.mojo + build-helper-maven-plugin + + + add-source + + add-source + + + + source/compatibility + + + + + add-test-source + + add-test-source + + + + unit-test/java + + + + + + + maven-antrun-plugin + + + prepare-package + + run + + + + + + + + + + + + + + org.codehaus.mojo + properties-maven-plugin + + + initialize + + read-project-properties + + + + ${basedir}/src/main/resources/local.properties + + true + + + + + + org.apache.maven.plugins + maven-surefire-plugin + + + **/AllUnitTestSuite.class + + + + + org.apache.maven.plugins + maven-failsafe-plugin + + + integration-tests + + integration-test + verify + + + ${skip.integrationtests} + + **/AllTestSuite.class + + + ${project.build.directory}/${project.build.finalName}/config + + + + + + + org.apache.maven.plugins + maven-dependency-plugin + + + unpack-alfresco + prepare-package + + unpack + + + ${app.amp.client.war.folder} + + + ${alfresco.groupId} + ${app.amp.client.war.artifactId} + war + ${alfresco.version} + + + + + + + + org.alfresco.maven.plugin + alfresco-maven-plugin + + + attach-rm-jar + + amp + + + true + true + true + + + + amps-to-war-overlay + package + + install + + + + + + org.apache.maven.plugins + maven-jar-plugin + + + + test-jar + + + + + + **/alfresco-global.properties + + + + + org.codehaus.mojo + license-maven-plugin + + alfresco_community + + source/java + unit-test/java + source/compatibility + config + test/java + test/resources + + + + + + + + org.eclipse.m2e + lifecycle-mapping + + + + + + org.codehaus.mojo + properties-maven-plugin + [1.0-alpha-2,) + + read-project-properties + + + + + + + + + org.codehaus.mojo + license-maven-plugin + [1.8,) + + update-file-header + + + + + + + + + + + + + + + + + ${alfresco.groupId} + alfresco-remote-api + + + io.takari.junit + takari-cpsuite + 1.2.7 + test + + + junit + junit + test + + + org.springframework.extensions.surf + spring-webscripts + tests + test + + + org.mockito + mockito-all + test + + + org.springframework + spring-test + 2.5 + test + + + ${alfresco.groupId} + alfresco-repository + ${alfresco.version} + tests + test + + + ${alfresco.groupId} + alfresco-remote-api + ${alfresco.version} + tests + test + + + postgresql + postgresql + ${alfresco.postgres.version} + test + + + mysql + mysql-connector-java + test + + + ${alfresco.groupId} + alfresco-repository + ${alfresco.version} + h2scripts + + + * + * + + + test + + + + + + use-mysql + + ${my.db.name} + ${my.db.port} + org.hibernate.dialect.MySQLInnoDBDialect + + jdbc:mysql://${alfresco.db.host}:${alfresco.db.port}/${alfresco.db.name} + jdbc:mysql://${alfresco.db.host}:${alfresco.db.port}/${alfresco.db.name} + org.gjt.mm.mysql.Driver + + + + use-postgres + + ${my.db.name} + ${my.db.port} + org.hibernate.dialect.PostgreSQLDialect + + jdbc:postgresql:template1 + jdbc:postgresql:${alfresco.db.name} + org.postgresql.Driver + + + + start-repo + + + + org.apache.maven.plugins + maven-dependency-plugin + + + unpack-alfresco + prepare-package + + unpack + + + ${app.amp.client.war.folder} + + + ${alfresco.groupId} + ${alfresco.repo.artifactId} + war + ${alfresco.version} + + + + + + unpack-alfresco-config + + unpack + + generate-resources + + ${alfresco.solr.home} + + + alfresco-solr4 + ${alfresco.groupId} + config + ${alfresco.version} + zip + + + + + + + + org.alfresco.maven.plugin + alfresco-maven-plugin + + + amps-to-war-overlay + package + + install + + + + + false + + + + org.codehaus.mojo + build-helper-maven-plugin + + + regex-property + generate-resources + + regex-property + + + solrHomePath + ${alfresco.solr.home} + \\ + \\\\ + false + + + + + + com.google.code.maven-replacer-plugin + replacer + + + setup-solr-config + generate-resources + + replace + + + + + false + + ${alfresco.solr.home}/context.xml + ${alfresco.solr.home}/archive-SpacesStore/conf/solrcore.properties + ${alfresco.solr.home}/workspace-SpacesStore/conf/solrcore.properties + ${app.amp.client.war.folder}/WEB-INF/web.xml + + + + @@ALFRESCO_SOLR4_DIR@@ + ${solrHomePath}/ + + + @@ALFRESCO_SOLR4_MODEL_DIR@@ + ${solrHomePath}/alfrescoModels/ + + + @@ALFRESCO_SOLR4_CONTENT_DIR@@ + ${solrHomePath}/data/content/ + + + @@ALFRESCO_SOLR4_DATA_DIR@@ + ${solrHomePath}/data/index/ + + + ]]> + + + + ]]> + ]]> + + + + + + org.apache.tomcat.maven + tomcat7-maven-plugin + + + run-embedded + + run + + integration-test + + false + true + true + + ${project.build.directory} + + false + ${project.basedir}/tomcat/context.xml + + + ${alfresco.groupId} + alfresco-solr4 + ${alfresco.version} + war + true + /solr4 + ${alfresco.solr.home}/context.xml + + + + + + + + postgresql + postgresql + ${alfresco.postgres.version} + + + mysql + mysql-connector-java + ${alfresco.mysql.version} + + + ${alfresco.groupId} + alfresco-repository + ${alfresco.version} + h2scripts + + + * + * + + + + + + + + + + + wipeDB + + + + org.codehaus.mojo + sql-maven-plugin + + true + ${alfresco.db.datasource.class} + ${alfresco.db.master.url} + ${alfresco.db.username} + ${alfresco.db.password} + + + + postgresql + postgresql + ${alfresco.postgres.version} + + + mysql + mysql-connector-java + ${alfresco.mysql.version} + + + + + wipe-database + process-test-resources + + execute + + + drop database if exists alfresco + + + + create-database + process-test-resources + + execute + + + create database alfresco + + + + + + + + + \ No newline at end of file From ac0a7e701687a971ac778e6a8719e5ff565bc724 Mon Sep 17 00:00:00 2001 From: Mihai Cozma Date: Tue, 31 May 2016 18:16:32 +0300 Subject: [PATCH 3/5] Create Hold and Transfer container exception --- .../rm-model-context.xml | 6 ++ .../model/rma/type/HoldContainerType.java | 84 ++++++++++++++++++ .../model/rma/type/TransferContainerType.java | 80 +++++++++++++++++ .../model/rma/type/HoldContainerTypeTest.java | 87 +++++++++++++++++++ .../rma/type/TransferContainerTypeTest.java | 81 +++++++++++++++++ 5 files changed, 338 insertions(+) create mode 100644 rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/type/HoldContainerType.java create mode 100644 rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/type/TransferContainerType.java create mode 100644 rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/model/rma/type/HoldContainerTypeTest.java create mode 100644 rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/model/rma/type/TransferContainerTypeTest.java diff --git a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/rm-model-context.xml b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/rm-model-context.xml index 96130f9e01..b0360da5ed 100644 --- a/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/rm-model-context.xml +++ b/rm-community/rm-community-repo/config/alfresco/module/org_alfresco_module_rm/rm-model-context.xml @@ -78,6 +78,12 @@ + + + + + + diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/type/HoldContainerType.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/type/HoldContainerType.java new file mode 100644 index 0000000000..49c5931e54 --- /dev/null +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/type/HoldContainerType.java @@ -0,0 +1,84 @@ +/* + * #%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.model.rma.type; + +import org.alfresco.error.AlfrescoRuntimeException; +import org.alfresco.model.ContentModel; +import org.alfresco.module.org_alfresco_module_rm.model.BaseBehaviourBean; +import org.alfresco.repo.node.NodeServicePolicies; +import org.alfresco.repo.policy.annotation.Behaviour; +import org.alfresco.repo.policy.annotation.BehaviourBean; +import org.alfresco.repo.policy.annotation.BehaviourKind; +import org.alfresco.service.cmr.repository.ChildAssociationRef; +import org.alfresco.service.cmr.repository.NodeRef; +import org.springframework.extensions.surf.util.I18NUtil; + + + +/** + * rma:holdContainer behaviour bean + * + * @author Mihai Cozma + * @since 2.4 + */ +@BehaviourBean +( + defaultType = "rma:holdContainer" +) +public class HoldContainerType extends BaseBehaviourBean + implements NodeServicePolicies.OnCreateChildAssociationPolicy, NodeServicePolicies.OnCreateNodePolicy +{ + private final static String MSG_ERROR_ADD_CONTENT_CONTAINER = "rm.service.error-add-content-container"; + + /** + * On every event + * + * @see org.alfresco.repo.node.NodeServicePolicies.OnCreateChildAssociationPolicy#onCreateChildAssociation(org.alfresco.service.cmr.repository.ChildAssociationRef, + * boolean) + */ + @Override + @Behaviour(kind = BehaviourKind.ASSOCIATION) + public void onCreateChildAssociation(ChildAssociationRef childAssocRef, boolean bNew) + { + + NodeRef nodeRef = childAssocRef.getChildRef(); + if (instanceOf(nodeRef, ContentModel.TYPE_CONTENT) == true) + { + throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_ERROR_ADD_CONTENT_CONTAINER)); + } + + } + + @Override + public void onCreateNode(ChildAssociationRef childAssocRef) + { + NodeRef nodeRef = childAssocRef.getChildRef(); + if (instanceOf(nodeRef, ContentModel.TYPE_CONTENT)) { throw new AlfrescoRuntimeException( + "Operation failed, because you can't place content directly in hold container."); } + + } +} diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/type/TransferContainerType.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/type/TransferContainerType.java new file mode 100644 index 0000000000..a949622486 --- /dev/null +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/type/TransferContainerType.java @@ -0,0 +1,80 @@ +/* + * #%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.model.rma.type; + +import org.alfresco.error.AlfrescoRuntimeException; +import org.alfresco.model.ContentModel; +import org.alfresco.module.org_alfresco_module_rm.model.BaseBehaviourBean; +import org.alfresco.repo.node.NodeServicePolicies; +import org.alfresco.repo.policy.annotation.Behaviour; +import org.alfresco.repo.policy.annotation.BehaviourBean; +import org.alfresco.repo.policy.annotation.BehaviourKind; +import org.alfresco.service.cmr.repository.ChildAssociationRef; +import org.alfresco.service.cmr.repository.NodeRef; + + + +/** + * rma:transferContainer behaviour bean + * + * @author Mihai Cozma + * @since 2.4 + */ +@BehaviourBean +( + defaultType = "rma:transferContainer" +) +public class TransferContainerType extends BaseBehaviourBean + implements NodeServicePolicies.OnCreateChildAssociationPolicy, NodeServicePolicies.OnCreateNodePolicy +{ + + /** + * On every event + * + * @see org.alfresco.repo.node.NodeServicePolicies.OnCreateChildAssociationPolicy#onCreateChildAssociation(org.alfresco.service.cmr.repository.ChildAssociationRef, + * boolean) + */ + @Override + @Behaviour(kind = BehaviourKind.ASSOCIATION) + public void onCreateChildAssociation(ChildAssociationRef childAssocRef, boolean bNew) + { + // ensure not content to be added in Holdsfolder + NodeRef nodeRef = childAssocRef.getChildRef(); + if (instanceOf(nodeRef, ContentModel.TYPE_CONTENT)) { throw new AlfrescoRuntimeException( + "Operation failed, because you can't place content directly into a record category."); } + + } + + @Override + public void onCreateNode(ChildAssociationRef childAssocRef) + { + NodeRef nodeRef = childAssocRef.getChildRef(); + if (instanceOf(nodeRef, ContentModel.TYPE_CONTENT)) { throw new AlfrescoRuntimeException( + "Operation failed, because you can't place content directly into a record category."); } + + } +} diff --git a/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/model/rma/type/HoldContainerTypeTest.java b/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/model/rma/type/HoldContainerTypeTest.java new file mode 100644 index 0000000000..60ac81f490 --- /dev/null +++ b/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/model/rma/type/HoldContainerTypeTest.java @@ -0,0 +1,87 @@ +/* + * #%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.model.rma.type; + +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.never; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; + +import org.alfresco.error.AlfrescoRuntimeException; +import org.alfresco.model.ContentModel; +import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; +import org.alfresco.module.org_alfresco_module_rm.test.util.BaseUnitTest; +import org.alfresco.service.cmr.repository.ChildAssociationRef; +import org.alfresco.service.cmr.repository.NodeRef; +import org.junit.Test; +import org.mockito.InjectMocks; + +/** + * Unit test for HoldContainerTypeTest + * + * @author Mihai Cozma + * @since 2.4 + */ +public class HoldContainerTypeTest extends BaseUnitTest +{ + /** test object */ + private @InjectMocks HoldContainerType holdContainerType; + + /** + * Having the Unfilled Record container and a folder having the aspect ASPECT_HIDDEN When adding a child association + * between the folder and the container Then the folder type shouldn't be renamed + */ + @Test (expected = AlfrescoRuntimeException.class) + public void testAddContentToHoldContainer() + { + + NodeRef holdContainer = createHoldContainer(); + + /* + * When adding a child association between the folder and the container + */ + NodeRef record = generateNodeRef(ContentModel.TYPE_CONTENT); + ChildAssociationRef childAssoc = new ChildAssociationRef( ContentModel.TYPE_CONTENT, holdContainer, + ContentModel.TYPE_CONTENT, record); + + holdContainerType.onCreateChildAssociation(childAssoc, true); + + } + + /** + * Generates a record management container + * + * @return reference to the generated container + */ + private NodeRef createHoldContainer() + { + NodeRef holdContainer = generateNodeRef(TYPE_HOLD_CONTAINER, true); + + return holdContainer; + } + +} diff --git a/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/model/rma/type/TransferContainerTypeTest.java b/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/model/rma/type/TransferContainerTypeTest.java new file mode 100644 index 0000000000..95fe49f052 --- /dev/null +++ b/rm-community/rm-community-repo/unit-test/java/org/alfresco/module/org_alfresco_module_rm/model/rma/type/TransferContainerTypeTest.java @@ -0,0 +1,81 @@ +/* + * #%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.model.rma.type; + +import org.alfresco.error.AlfrescoRuntimeException; +import org.alfresco.model.ContentModel; +import org.alfresco.module.org_alfresco_module_rm.test.util.BaseUnitTest; +import org.alfresco.service.cmr.repository.ChildAssociationRef; +import org.alfresco.service.cmr.repository.NodeRef; +import org.junit.Test; +import org.mockito.InjectMocks; + +/** + * Unit test for TransferContainerTypeTest + * + * @author Mihai Cozma + * @since 2.4 + */ +public class TransferContainerTypeTest extends BaseUnitTest +{ + /** test object */ + private @InjectMocks TransferContainerType transferContainerType; + + /** + * Having the Unfilled Record container and a folder having the aspect ASPECT_HIDDEN When adding a child association + * between the folder and the container Then the folder type shouldn't be renamed + */ + @Test(expected = AlfrescoRuntimeException.class) + public void testAddContentToTransferContainerTest() + { + + NodeRef transferContainer = createTransferContainer(); + + /* + * When adding a child association between the folder and the container + */ + NodeRef record = generateNodeRef(ContentModel.TYPE_CONTENT); + ChildAssociationRef childAssoc = new ChildAssociationRef(ContentModel.TYPE_CONTENT, transferContainer, + ContentModel.TYPE_CONTENT, record); + + transferContainerType.onCreateChildAssociation(childAssoc, true); + + } + + /** + * Generates a record management container + * + * @return reference to the generated container + */ + private NodeRef createTransferContainer() + { + NodeRef holdContainer = generateNodeRef(TYPE_TRANSFER, true); + + return holdContainer; + } + +} From a5b59b435663cd47d2ff7047be2fcb63ed9c21ae Mon Sep 17 00:00:00 2001 From: Mihai Cozma Date: Mon, 6 Jun 2016 11:21:51 +0300 Subject: [PATCH 4/5] RM-3341 - Outlook Integrations:Emails can be added to the Holds /Transfers from Outlook Integration --- .../model/rma/type/HoldContainerType.java | 17 +-- .../model/rma/type/TransferContainerType.java | 19 +-- .../test/integration/issue/RM3341Test.java | 122 ++++++++++++++++++ 3 files changed, 134 insertions(+), 24 deletions(-) create mode 100644 rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/issue/RM3341Test.java diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/type/HoldContainerType.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/type/HoldContainerType.java index 49c5931e54..c01f544991 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/type/HoldContainerType.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/type/HoldContainerType.java @@ -37,18 +37,13 @@ import org.alfresco.service.cmr.repository.ChildAssociationRef; import org.alfresco.service.cmr.repository.NodeRef; import org.springframework.extensions.surf.util.I18NUtil; - - /** * rma:holdContainer behaviour bean * * @author Mihai Cozma * @since 2.4 */ -@BehaviourBean -( - defaultType = "rma:holdContainer" -) +@BehaviourBean(defaultType = "rma:holdContainer") public class HoldContainerType extends BaseBehaviourBean implements NodeServicePolicies.OnCreateChildAssociationPolicy, NodeServicePolicies.OnCreateNodePolicy { @@ -66,10 +61,8 @@ public class HoldContainerType extends BaseBehaviourBean { NodeRef nodeRef = childAssocRef.getChildRef(); - if (instanceOf(nodeRef, ContentModel.TYPE_CONTENT) == true) - { - throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_ERROR_ADD_CONTENT_CONTAINER)); - } + if (instanceOf(nodeRef, ContentModel.TYPE_CONTENT) == true) { throw new AlfrescoRuntimeException( + I18NUtil.getMessage(MSG_ERROR_ADD_CONTENT_CONTAINER)); } } @@ -77,8 +70,8 @@ public class HoldContainerType extends BaseBehaviourBean public void onCreateNode(ChildAssociationRef childAssocRef) { NodeRef nodeRef = childAssocRef.getChildRef(); - if (instanceOf(nodeRef, ContentModel.TYPE_CONTENT)) { throw new AlfrescoRuntimeException( - "Operation failed, because you can't place content directly in hold container."); } + if (instanceOf(nodeRef, ContentModel.TYPE_CONTENT) == true) { throw new AlfrescoRuntimeException( + I18NUtil.getMessage(MSG_ERROR_ADD_CONTENT_CONTAINER)); } } } diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/type/TransferContainerType.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/type/TransferContainerType.java index a949622486..a557cf2efe 100644 --- a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/type/TransferContainerType.java +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/type/TransferContainerType.java @@ -35,8 +35,7 @@ import org.alfresco.repo.policy.annotation.BehaviourBean; import org.alfresco.repo.policy.annotation.BehaviourKind; import org.alfresco.service.cmr.repository.ChildAssociationRef; import org.alfresco.service.cmr.repository.NodeRef; - - +import org.springframework.extensions.surf.util.I18NUtil; /** * rma:transferContainer behaviour bean @@ -44,13 +43,11 @@ import org.alfresco.service.cmr.repository.NodeRef; * @author Mihai Cozma * @since 2.4 */ -@BehaviourBean -( - defaultType = "rma:transferContainer" -) +@BehaviourBean(defaultType = "rma:transferContainer") public class TransferContainerType extends BaseBehaviourBean implements NodeServicePolicies.OnCreateChildAssociationPolicy, NodeServicePolicies.OnCreateNodePolicy { + private final static String MSG_ERROR_ADD_CONTENT_CONTAINER = "rm.service.error-add-content-container"; /** * On every event @@ -64,17 +61,15 @@ public class TransferContainerType extends BaseBehaviourBean { // ensure not content to be added in Holdsfolder NodeRef nodeRef = childAssocRef.getChildRef(); - if (instanceOf(nodeRef, ContentModel.TYPE_CONTENT)) { throw new AlfrescoRuntimeException( - "Operation failed, because you can't place content directly into a record category."); } - + if (instanceOf(nodeRef, ContentModel.TYPE_CONTENT) == true) { throw new AlfrescoRuntimeException( + I18NUtil.getMessage(MSG_ERROR_ADD_CONTENT_CONTAINER)); } } @Override public void onCreateNode(ChildAssociationRef childAssocRef) { NodeRef nodeRef = childAssocRef.getChildRef(); - if (instanceOf(nodeRef, ContentModel.TYPE_CONTENT)) { throw new AlfrescoRuntimeException( - "Operation failed, because you can't place content directly into a record category."); } - + if (instanceOf(nodeRef, ContentModel.TYPE_CONTENT) == true) { throw new AlfrescoRuntimeException( + I18NUtil.getMessage(MSG_ERROR_ADD_CONTENT_CONTAINER)); } } } diff --git a/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/issue/RM3341Test.java b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/issue/RM3341Test.java new file mode 100644 index 0000000000..fdf38a09f2 --- /dev/null +++ b/rm-community/rm-community-repo/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/issue/RM3341Test.java @@ -0,0 +1,122 @@ +/* + * #%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.issue; + +import org.alfresco.error.AlfrescoRuntimeException; +import org.alfresco.model.ContentModel; +import org.alfresco.module.org_alfresco_module_rm.capability.RMPermissionModel; +import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase; +import org.alfresco.service.cmr.model.FileInfo; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.cmr.security.AccessStatus; +import org.springframework.extensions.surf.util.I18NUtil; + +/** + * Unit test for RM-3341 .. can copy to hold and transfer folder + * + * @since 2.4 + */ +public class RM3341Test extends BaseRMTestCase +{ + + private final static String MSG_ERROR_ADD_CONTENT_CONTAINER = "rm.service.error-add-content-container"; + + public void testCopyingContentsInHoldandTransfer() throws Exception + { + doTestInTransaction(new Test() + { + @Override + public Void run() + { + NodeRef holdContainer = filePlanService.getHoldContainer(filePlan); + assertNotNull(holdContainer); + NodeRef transferContainer = filePlanService.getTransferContainer(filePlan); + assertNotNull(transferContainer); + + assertEquals(AccessStatus.ALLOWED, + permissionService.hasPermission(holdContainer, RMPermissionModel.FILING)); + assertEquals(AccessStatus.ALLOWED, + permissionService.hasPermission(transferContainer, RMPermissionModel.FILING)); + + return null; + } + }, ADMIN_USER); + + doTestInTransaction(new Test() + { + @Override + + public Void run() + { + + NodeRef holdContainer = filePlanService.getHoldContainer(filePlan); + assertNotNull(holdContainer); + + try + { + FileInfo copyInfo = fileFolderService.create(holdContainer, "test file", ContentModel.TYPE_CONTENT); + fail("This should have thrown an exception"); + } + catch (AlfrescoRuntimeException e) + { + // ("Content can't be added to a record container. Use record folders to file content.") + assertEquals(I18NUtil.getMessage(MSG_ERROR_ADD_CONTENT_CONTAINER), e.getMsgId()); + } + return null; + } + + }); + doTestInTransaction(new Test() + { + @Override + + public Void run() + { + + NodeRef transferContainer = filePlanService.getTransferContainer(filePlan); + assertNotNull(transferContainer); + + try + { + + fileFolderService.create(transferContainer, "test content", ContentModel.TYPE_CONTENT); + + fail("This should have thrown an exception"); + + } + catch (AlfrescoRuntimeException e) + { + // ("Content can't be added to a record container. Use record folders to file content.") + assertEquals(I18NUtil.getMessage(MSG_ERROR_ADD_CONTENT_CONTAINER), e.getMsgId()); + } + return null; + } + + }); + } +} From 4d7fcae9b965ecdac936f508f404f09062dfe7b2 Mon Sep 17 00:00:00 2001 From: Tom Page Date: Thu, 23 Jun 2016 11:24:16 +0100 Subject: [PATCH 5/5] RM-3566 Update security controls API. Create a Java API to allow adding and removing specified security controls without affecting other marks on the node. --- .../util/UpdateActionType.java | 42 +++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/util/UpdateActionType.java diff --git a/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/util/UpdateActionType.java b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/util/UpdateActionType.java new file mode 100644 index 0000000000..ffaba58fc2 --- /dev/null +++ b/rm-community/rm-community-repo/source/java/org/alfresco/module/org_alfresco_module_rm/util/UpdateActionType.java @@ -0,0 +1,42 @@ +/* + * #%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.util; + +import org.alfresco.api.AlfrescoPublicApi; + +/** + * An enumeration for the methods of updating a collection of immutable objects. + * + * @author Tom Page + * @since 2.5 + */ +@AlfrescoPublicApi +public enum UpdateActionType +{ + ADD, + REMOVE; +}