diff --git a/README.txt b/README.txt index 6ba100ecd2..17e30e68a9 100644 --- a/README.txt +++ b/README.txt @@ -12,42 +12,37 @@ Initial Setup - Create a normal project using "create-project" - Check out RM code into the "code" directory (eg "checkout https://svn.alfresco.com/repos/alfresco-enterprise/modules/recordsmanagement/HEAD") - Create the tomcat instances using "use-tomcat7" and "use-app-tomcat7" - - If you've got SOLR config in your $DEV_HOME/projects/repository.properties file, then you'll need to remove it or fix it in the RM project level properties file. -Using Eclipse (or IntelliJ) + +Using Eclipse - Import projects as Maven projects ("Import > Maven > Existing Maven Projects") - Browse to the code directory of your project and select "rm-server/pom.xml" and "rm-share/pom.xml". DO NOT select the parent "/pom.xml" - Open the Ant view and add the build files for both modules ("build.xml") - - If you are not working on a Windows machine you need to change the value of a property called "mvn.exec". - To do this create a file called "build.local.properties" under the code directory and change the value in that new file. - Run the "prepareEnv" target for rm-server which will prepare the development environment. This target must be run just once. - - Now "fullBuildCommunity" or "fullBuildEnterprise" target (depending which version of Alfresco you want as dependency) can be run which will create the amp file, apply it to the war file and copy the war file to webapps folder. + - Now "buildAndDeploy" target can be run which will create the amp file, apply it to the war file and copy the war file to webapps folder. Summary of Available Ant Targets - - fullBuildCommunity : Creates the amp file and applies it to the Community war file - - fullBuildEnterprise : Creates the amp file and applies it to the Enterprise war file - - incrementalBuild : Creates the jar file and copies the jar file with other files like css, js, ftl, etc. files + - assembleIconPackage : Assembles an icons package for the module + - assembleLocalisationPackage : Assembles an i18n package for the module + - buildAndDeploy : Creates the amp file and applies it to the war file + - prepareEnv : Prepares the development environment (must be run just once) + - tomcat-start : Starts a tomcat instance + - tomcat-start-debug : Starts a tomcat instance in debug mode + - tomcat-stop : Stops the running tomcat instance Summary of Available Internal Ant Targets - alfresco:amp : Creates the amp file using alfresco maven plugin - - alfresco:install : Installs the amp file to the Community war file - - alfresco:installEnterprise : Installs the amp file to the Enterprise war file - - assembleIconPackage : Assembles an icons package for the module - - configureSolr4 : Configures Solr4 for Alfresco (creates two directories "solr4" and "solr4config" under the "data" directory) + - alfresco:install : Installs the amp file to the war file + - cleanTarget : Deletes the "target" folder - copyDBDriver : Copies the DB driver - copyDevContextFile : Copies the dev-context.xml file - copyWarFileToTomcat : Copies the war file (amp applied) to the webapp folder - - copyWebDirectory : Copies the source/web folder - deleteExplodedWar : Deletes the exploded war file - deleteWarFile : Deletes the war file - - fetchSolr : Gets the the Solr artifact - - fetchWarFile : Gets the "original" Community war file - - fetchEntpriseWarFile : Gets the "original" Enterprise war file - - package : Executes the "mvn package" command - - prepareEnv : Prepares the development environment (must be run just once) - - unitTest : Runs the unit tests \ No newline at end of file + - fetchWarFile : Gets the "original" war file + - install : Executes the "mvn install" command \ No newline at end of file diff --git a/build.xml b/build.xml index 99c4820f54..b66671e98d 100644 --- a/build.xml +++ b/build.xml @@ -8,6 +8,17 @@ + + + + + + + + + + + @@ -20,18 +31,6 @@ - - - - - - - - - - - - @@ -40,12 +39,8 @@ - + - - - - @@ -56,20 +51,38 @@ - - - - - - - - + - + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -77,7 +90,7 @@ - + @@ -85,16 +98,11 @@ - - - - - - - - - - + + + + + @@ -106,6 +114,4 @@ - - diff --git a/l10n.properties b/l10n.properties deleted file mode 100644 index 25d85776f6..0000000000 --- a/l10n.properties +++ /dev/null @@ -1,4 +0,0 @@ -# Localisation config overrides for Records Management module -MESSAGE_SEARCH_PATH="rm-server/config rm-share/config" -EXCLUDED_FILES="$EXCLUDED_FILES rm-method-security.properties" -EXTENSION_PREFIX=-RM \ No newline at end of file diff --git a/pom.xml b/pom.xml index e642ae2f19..76f272a5d0 100644 --- a/pom.xml +++ b/pom.xml @@ -4,13 +4,9 @@ org.alfresco alfresco-rm-parent pom - 3.0-SNAPSHOT + 2.2.1-SNAPSHOT Alfresco Records Management - - org.alfresco.maven - alfresco-sdk-parent - 2.0.0 - + http://www.alfresco.org/ 2005 @@ -64,27 +60,13 @@ - - - - ${alfresco.groupId} - alfresco-platform-distribution - ${alfresco.version} - pom - import - - - - rm-server rm-share - 5.0 - ${project.build.directory}/${webapp.id.name}.war - ${alfresco.version} + 4.2.4.6 org.postgresql.Driver @@ -96,9 +78,10 @@ false 1.7 - 1.8 UTF-8 - -Xmx1024m -XX:MaxPermSize=256m -Duser.language=en -Dcom.sun.management.jmxremote + + + ${project.build.directory}/jacoco.exec @@ -116,7 +99,7 @@ - 1.8 + 1.7.0 @@ -130,9 +113,25 @@ true ${project.build.directory}/${project.build.finalName}-amp.amp - ${app.war.location} + ${project.build.directory}/${webapp.id}.war amp - true + + + + maven-war-plugin + + + + org.alfresco + ${webapp.id} + war + + + org.alfresco + ${project.artifactId} + amp + + @@ -146,24 +145,11 @@ maven-compiler-plugin - 3.2 + 3.1 ${maven.build.sourceVersion} ${maven.build.sourceVersion} - - - default-testCompile - process-test-sources - - testCompile - - - ${maven.build.testSourceVersion} - ${maven.build.testSourceVersion} - - - maven-deploy-plugin @@ -212,6 +198,7 @@ true alphabetical + -Xmx1024m -XX:MaxPermSize=256m -Duser.language=en -Dcom.sun.management.jmxremote ${db.url} @@ -320,4 +307,4 @@ - + \ No newline at end of file diff --git a/rm-automation/pom.xml b/rm-automation/pom.xml deleted file mode 100644 index fc74443a94..0000000000 --- a/rm-automation/pom.xml +++ /dev/null @@ -1,312 +0,0 @@ - - - - org.alfresco - alfresco-rm-parent - 3.0-SNAPSHOT - - 4.0.0 - alfresco-rm-automation - - 2.43.1 - 4.0.5.RELEASE - - - - - - org.codehaus.mojo - build-helper-maven-plugin - - - add-test-source - - add-test-source - - - - src/unit-test/java - - - - - - - maven-surefire-plugin - - false - - - usedefaultlisteners - false - - - listener - org.uncommons.reportng.HTMLReporter, org.uncommons.reportng.JUnitXMLReporter - - - - ${project.build.testOutputDirectory}/testng.xml - - - - - - maven-antrun-plugin - - - default-cli - - - Stopping Alfresco... - - - - - - - - - - - - - org.alfresco - webdrone - 2.6.1 - - - org.seleniumhq.selenium - selenium-java - ${selenium.version} - - - org.seleniumhq.selenium - selenium-server - ${selenium.version} - test - - - org.springframework - spring-beans - ${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 - test - - - org.uncommons - reportng - 1.1.4 - test - - - ru.yandex.qatools.htmlelements - htmlelements-all - 1.12 - - - ru.yandex.qatools.properties - properties-loader - 1.5 - 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-share - ${project.version} - amp - amp - - - org.alfresco - alfresco-rm-server - ${project.version} - amp - amp - - - ${project.build.directory}/amps - true - - - - - - org.alfresco.maven.plugin - alfresco-maven-plugin - true - - - install-server-amp - - install - - process-test-resources - - true - ${project.build.directory}/amps/alfresco-rm-server-${project.version}-amp.amp - ${project.build.directory}/alf-installation/tomcat/webapps/alfresco.war - amp - - - - install-share-amp - - install - - process-test-resources - - true - ${project.build.directory}/amps/alfresco-rm-share-${project.version}-amp.amp - ${project.build.directory}/alf-installation/tomcat/webapps/share.war - amp - - - - - - - - - run-alfresco - - - - - org.jacoco - jacoco-maven-plugin - 0.6.3.201306030806 - - - 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... - - - - - - - - - - - - - \ No newline at end of file diff --git a/rm-server/build.properties b/rm-server/build.properties index fa6182cc67..97f39da896 100644 --- a/rm-server/build.properties +++ b/rm-server/build.properties @@ -5,4 +5,17 @@ app.war.artifactId=alfresco # Tomcat folder name used by the alfresco application -app.tomcat=tomcat \ No newline at end of file +app.tomcat=tomcat + +# SOLR configuration +solr.directory=solr +solr.artifactId=alfresco-solr +solr.packaging=zip +solr.package=${solr.artifactId}.${solr.packaging} + + +# DB driver properties +db.driver.groupId=postgresql +db.driver.artifactId=${db.driver.groupId} +db.driver.version=9.1-901.jdbc4 +db.driver.packaging=jar \ No newline at end of file diff --git a/rm-server/build.xml b/rm-server/build.xml index f82adf452e..425160f0f6 100644 --- a/rm-server/build.xml +++ b/rm-server/build.xml @@ -7,24 +7,13 @@ - + - - - - - - - - - - - - - - - + + + + @@ -35,97 +24,81 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ]]> - ]]> - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ]]> + ]]> + + + + + + + + + + \ No newline at end of file diff --git a/rm-server/config/alfresco/module/org_alfresco_module_rm/action-context.xml b/rm-server/config/alfresco/module/org_alfresco_module_rm/action-context.xml index 5ce959d53f..46cc7a2483 100644 --- a/rm-server/config/alfresco/module/org_alfresco_module_rm/action-context.xml +++ b/rm-server/config/alfresco/module/org_alfresco_module_rm/action-context.xml @@ -12,8 +12,7 @@ - - + @@ -25,42 +24,12 @@ - - - - - - - - - - - {http://www.alfresco.org/model/content/1.0}content - - - - - - - - - - - + - - - - - - - - - \ No newline at end of file diff --git a/rm-server/config/alfresco/module/org_alfresco_module_rm/alfresco-global.properties b/rm-server/config/alfresco/module/org_alfresco_module_rm/alfresco-global.properties index 358bcbd635..1270de1af6 100644 --- a/rm-server/config/alfresco/module/org_alfresco_module_rm/alfresco-global.properties +++ b/rm-server/config/alfresco/module/org_alfresco_module_rm/alfresco-global.properties @@ -49,11 +49,6 @@ rm.autocompletesuggestion.nodeParameterSuggester.aspectsAndTypes=rma:record,cm:c rm.dispositionlifecycletrigger.cronexpression=0 0/5 * * * ? # -# Records contributors group +# Indicates whether mandatory properties are checked before completing a record # -# if false then record contributor check is ignored and all users can contribute records from -# a collaboration site, if true then a user must be a member of the records contributor group -# in order for them to contribute a record from a collaboration site. Default value 'false'. -rm.record.contributors.group.enabled=false -# record contributors group, default value 'RECORD_CONTRIBUTORS' -rm.record.contributors.group.name=RECORD_CONTRIBUTORS +rm.completerecord.mandatorypropertiescheck.enabled=true diff --git a/rm-server/config/alfresco/module/org_alfresco_module_rm/bootstrap/content/recordsCustomModel.xml b/rm-server/config/alfresco/module/org_alfresco_module_rm/bootstrap/content/recordsCustomModel.xml index 9e3244ce81..b66fc56088 100644 --- a/rm-server/config/alfresco/module/org_alfresco_module_rm/bootstrap/content/recordsCustomModel.xml +++ b/rm-server/config/alfresco/module/org_alfresco_module_rm/bootstrap/content/recordsCustomModel.xml @@ -74,7 +74,7 @@ - Superseded By__Supersedes + SupersededBy__Supersedes false true @@ -87,7 +87,7 @@ - Obsoleted By__Obsoletes + ObsoletedBy__Obsoletes false true @@ -100,7 +100,7 @@ - Next Version__Previous Version + VersionedBy__Versions false true diff --git a/rm-server/config/alfresco/module/org_alfresco_module_rm/bootstrap/content/rmEventConfigBootstrap.json b/rm-server/config/alfresco/module/org_alfresco_module_rm/bootstrap/content/rmEventConfigBootstrap.json index 6eb58eff72..d0bb84cc0f 100644 --- a/rm-server/config/alfresco/module/org_alfresco_module_rm/bootstrap/content/rmEventConfigBootstrap.json +++ b/rm-server/config/alfresco/module/org_alfresco_module_rm/bootstrap/content/rmEventConfigBootstrap.json @@ -26,11 +26,6 @@ "eventName" : "superseded", "eventDisplayLabel" : "rmevent.superseded" }, - { - "eventType" : "rmEventType.versioned", - "eventName" : "versioned", - "eventDisplayLabel" : "rmevent.versioned" - }, { "eventType" : "rmEventType.simple", "eventName" : "study_complete", diff --git a/rm-server/config/alfresco/module/org_alfresco_module_rm/capability/rm-capabilities-condition-context.xml b/rm-server/config/alfresco/module/org_alfresco_module_rm/capability/rm-capabilities-condition-context.xml index 408cbbf617..ba58d29116 100644 --- a/rm-server/config/alfresco/module/org_alfresco_module_rm/capability/rm-capabilities-condition-context.xml +++ b/rm-server/config/alfresco/module/org_alfresco_module_rm/capability/rm-capabilities-condition-context.xml @@ -14,20 +14,17 @@ - - - - + - - - \ No newline at end of file diff --git a/rm-server/config/alfresco/module/org_alfresco_module_rm/capability/rm-capabilities-disposition-context.xml b/rm-server/config/alfresco/module/org_alfresco_module_rm/capability/rm-capabilities-disposition-context.xml index 5f4f44880b..2688b3c450 100644 --- a/rm-server/config/alfresco/module/org_alfresco_module_rm/capability/rm-capabilities-disposition-context.xml +++ b/rm-server/config/alfresco/module/org_alfresco_module_rm/capability/rm-capabilities-disposition-context.xml @@ -157,30 +157,6 @@ - - - - - - - - RECORD_FOLDER - RECORD - - - - - - - - - - - - - - - @@ -242,7 +217,6 @@ - @@ -312,5 +286,24 @@ + + + + + + + RECORD_FOLDER + RECORD + + + + + + + + + + \ No newline at end of file diff --git a/rm-server/config/alfresco/module/org_alfresco_module_rm/capability/rm-capabilities-fileplan-context.xml b/rm-server/config/alfresco/module/org_alfresco_module_rm/capability/rm-capabilities-fileplan-context.xml index b42957bd9f..a94603f85b 100644 --- a/rm-server/config/alfresco/module/org_alfresco_module_rm/capability/rm-capabilities-fileplan-context.xml +++ b/rm-server/config/alfresco/module/org_alfresco_module_rm/capability/rm-capabilities-fileplan-context.xml @@ -71,20 +71,12 @@ + parent="declarativeCapability"> UNFILED_RECORD_CONTAINER - UNFILED_RECORD_FOLDER - - - - - - - diff --git a/rm-server/config/alfresco/module/org_alfresco_module_rm/capability/rm-capabilities-freeze-context.xml b/rm-server/config/alfresco/module/org_alfresco_module_rm/capability/rm-capabilities-freeze-context.xml index 8db7ba051b..1492b420ba 100644 --- a/rm-server/config/alfresco/module/org_alfresco_module_rm/capability/rm-capabilities-freeze-context.xml +++ b/rm-server/config/alfresco/module/org_alfresco_module_rm/capability/rm-capabilities-freeze-context.xml @@ -11,13 +11,12 @@ - FILE_PLAN HOLD_CONTAINER - + diff --git a/rm-server/config/alfresco/module/org_alfresco_module_rm/capability/rm-capabilities-group-context.xml b/rm-server/config/alfresco/module/org_alfresco_module_rm/capability/rm-capabilities-group-context.xml index fdb478b0a2..17bbf38dee 100644 --- a/rm-server/config/alfresco/module/org_alfresco_module_rm/capability/rm-capabilities-group-context.xml +++ b/rm-server/config/alfresco/module/org_alfresco_module_rm/capability/rm-capabilities-group-context.xml @@ -24,7 +24,6 @@ - @@ -44,6 +43,7 @@ + @@ -62,6 +62,7 @@ + @@ -133,7 +134,6 @@ - @@ -152,7 +152,6 @@ - @@ -170,7 +169,6 @@ - @@ -187,7 +185,6 @@ - @@ -206,7 +203,6 @@ - diff --git a/rm-server/config/alfresco/module/org_alfresco_module_rm/capability/rm-capabilities-record-context.xml b/rm-server/config/alfresco/module/org_alfresco_module_rm/capability/rm-capabilities-record-context.xml index 8b82723be3..7fdded0880 100644 --- a/rm-server/config/alfresco/module/org_alfresco_module_rm/capability/rm-capabilities-record-context.xml +++ b/rm-server/config/alfresco/module/org_alfresco_module_rm/capability/rm-capabilities-record-context.xml @@ -17,14 +17,6 @@ - - - RECORD - RECORD_FOLDER - UNFILED_RECORD_CONTAINER - UNFILED_RECORD_FOLDER - - @@ -116,11 +108,6 @@ parent="declarativeCapability"> - - - RECORD - - @@ -133,25 +120,6 @@ - - - - - - RECORD - - - - - - - - - - - - @@ -243,10 +211,9 @@ - + + parent="declarativeCapability"> @@ -264,7 +231,6 @@ - - - - - - - - - - - - \ No newline at end of file diff --git a/rm-server/config/alfresco/module/org_alfresco_module_rm/capability/rm-capabilities-recordfolder-context.xml b/rm-server/config/alfresco/module/org_alfresco_module_rm/capability/rm-capabilities-recordfolder-context.xml index 81658b0db5..88b27e7d33 100644 --- a/rm-server/config/alfresco/module/org_alfresco_module_rm/capability/rm-capabilities-recordfolder-context.xml +++ b/rm-server/config/alfresco/module/org_alfresco_module_rm/capability/rm-capabilities-recordfolder-context.xml @@ -33,12 +33,33 @@ + + + + + + @@ -209,19 +230,4 @@ - - - - - - - - - - - - - - \ No newline at end of file diff --git a/rm-server/config/alfresco/module/org_alfresco_module_rm/capability/rm-capabilities-reference-context.xml b/rm-server/config/alfresco/module/org_alfresco_module_rm/capability/rm-capabilities-reference-context.xml index 459b7790a2..39ec906d7a 100644 --- a/rm-server/config/alfresco/module/org_alfresco_module_rm/capability/rm-capabilities-reference-context.xml +++ b/rm-server/config/alfresco/module/org_alfresco_module_rm/capability/rm-capabilities-reference-context.xml @@ -20,4 +20,26 @@ + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/rm-server/config/alfresco/module/org_alfresco_module_rm/capability/rm-capabilities-security-context.xml b/rm-server/config/alfresco/module/org_alfresco_module_rm/capability/rm-capabilities-security-context.xml index c8a93a897b..60ca183ea8 100644 --- a/rm-server/config/alfresco/module/org_alfresco_module_rm/capability/rm-capabilities-security-context.xml +++ b/rm-server/config/alfresco/module/org_alfresco_module_rm/capability/rm-capabilities-security-context.xml @@ -22,7 +22,7 @@ - + @@ -31,13 +31,13 @@ - + diff --git a/rm-server/config/alfresco/module/org_alfresco_module_rm/dod5015/messages/dod5015-model_nb.properties b/rm-server/config/alfresco/module/org_alfresco_module_rm/dod5015/messages/dod5015-model_nb.properties deleted file mode 100644 index 94eb04cae4..0000000000 --- a/rm-server/config/alfresco/module/org_alfresco_module_rm/dod5015/messages/dod5015-model_nb.properties +++ /dev/null @@ -1,98 +0,0 @@ -dod_dod5015.description=DOD5015-innholdsmodell - -dod_dod5015.type.dod_site.title=DOD5015-omr\u00e5de -dod_dod5015.type.dod_site.description=DOD5015-omr\u00e5de - -dod_dod5015.type.dod_filePlan.title=DOD5015-filplan -dod_dod5015.type.dod_filePlan.description=DOD5015-filplan - -dod_dod5015.type.dod_recordSeries.title=Oppf\u00f8ringsserie (avskrevet) -dod_dod5015.type.dod_recordSeries.description=Oppf\u00f8ringsserie (avskrevet) - -dod_dod5015.aspect.dod_dod5015record.title=DOD5015-oppf\u00f8ring -dod_dod5015.aspect.dod_dod5015record.description=DOD5015-oppf\u00f8ring -dod_dod5015.property.dod_publicationDate.title=Publikasjonsdato -dod_dod5015.property.dod_publicationDate.decription=Publikasjonsdato -dod_dod5015.property.dod_originator.title=Avsender -dod_dod5015.property.dod_originator.decription=Avsender -dod_dod5015.property.dod_originatingOrganization.title=Utgangsorganisasjon -dod_dod5015.property.dod_originatingOrganization.decription=Utgangsorganisasjon -dod_dod5015.property.dod_mediaType.title=Medietype -dod_dod5015.property.dod_mediaType.decription=Medietype -dod_dod5015.property.dod_format.title=Format -dod_dod5015.property.dod_format.decription=Format -dod_dod5015.property.dod_dateReceived.title=Dato mottatt -dod_dod5015.property.dod_dateReceived.decription=Dato mottatt -dod_dod5015.property.dod_address.title=Mottaker -dod_dod5015.property.dod_address.decription=Mottaker -dod_dod5015.property.dod_otherAddress.title=Andre mottakere -dod_dod5015.property.dod_otherAddress.decription=Andre mottakere - -dod_dod5015.aspect.dod_scannedRecord.title=Skannet oppf\u00f8ring -dod_dod5015.aspect.dod_scannedRecord.description=Skannet oppf\u00f8ring -dod_dod5015.property.dod_scannedFormat.title=Bildeformat -dod_dod5015.property.dod_scannedFormat.description=Bildeformat -dod_dod5015.property.dod_scannedFormatVersion.title=Bildeformat og -versjon -dod_dod5015.property.dod_scannedFormatVersion.description=Bildeformat og -versjon -dod_dod5015.property.dod_resolutionX.title=Bildeoppl\u00f8sning X -dod_dod5015.property.dod_resolutionX.description=Bildeoppl\u00f8sning X -dod_dod5015.property.dod_resolutionY.title=Bildeoppl\u00f8sning Y -dod_dod5015.property.dod_resolutionY.description=Bildeoppl\u00f8sning Y -dod_dod5015.property.dod_scannedBitDepth.title=Skannet bitdybde -dod_dod5015.property.dod_scannedBitDepth.description=Skannet bitdybde - -dod_dod5015.aspect.dod_pdfRecord.title=PDF-oppf\u00f8ring -dod_dod5015.aspect.dod_pdfRecord.description=PDF-oppf\u00f8ring -dod_dod5015.property.dod_producingApplication.title=Produserende program -dod_dod5015.property.dod_producingApplication.description=Produserende program -dod_dod5015.property.dod_producingApplicationVersion.title=Produserende programversjon -dod_dod5015.property.dod_producingApplicationVersion.description=Produserende programversjon -dod_dod5015.property.dod_pdfVersion.title=PDF-versjon -dod_dod5015.property.dod_pdfVersion.description=PDF-versjon -dod_dod5015.property.dod_creatingApplication.title=Opprette program -dod_dod5015.property.dod_creatingApplication.description=Opprette program -dod_dod5015.property.dod_documentSecuritySettings.title=Innstillinger ved dokumentsikkerhet -dod_dod5015.property.dod_documentSecuritySettings.description=Innstillinger ved dokumentsikkerhet - -dod_dod5015.aspect.dod_digitalPhotographRecord.title=Digital bildeoppf\u00f8ring -dod_dod5015.aspect.dod_digitalPhotographRecord.description=Digital bildeoppf\u00f8ring -dod_dod5015.property.dod_caption.title=Tittel -dod_dod5015.property.dod_caption.description=Tittel -dod_dod5015.property.dod_photographer.title=Fotograf -dod_dod5015.property.dod_photographer.description=Fotograf -dod_dod5015.property.dod_copyright.title=Copyright -dod_dod5015.property.dod_copyright.description=Copyright -dod_dod5015.property.dod_bitDepth.title=Bitdybde -dod_dod5015.property.dod_bitDepth.description=Bitdybde -dod_dod5015.property.dod_imageSizeX.title=Bildest\u00f8rrelse X -dod_dod5015.property.dod_imageSizeX.description=Bildest\u00f8rrelse X -dod_dod5015.property.dod_imageSizeY.title=Bildest\u00f8rrelse Y -dod_dod5015.property.dod_imageSizeY.description=Bildest\u00f8rrelse Y -dod_dod5015.property.dod_imageSource.title=Bildekilde -dod_dod5015.property.dod_imageSource.description=Bildekilde -dod_dod5015.property.dod_compression.title=Komprimering -dod_dod5015.property.dod_compression.description=Komprimering -dod_dod5015.property.dod_iccIcmProfile.title=ICC/ICM-profil -dod_dod5015.property.dod_iccIcmProfile.description=ICC/ICM-profil -dod_dod5015.property.dod_exifInformation.title=EXIF-informasjon -dod_dod5015.property.dod_exifInformation.description=EXIF-informasjon - -dod_dod5015.aspect.dod_webRecord.title=Nettoppf\u00f8ring -dod_dod5015.aspect.dod_webRecord.description=Nettoppf\u00f8ring -dod_dod5015.property.dod_webFileName.title=Nettfilnavn -dod_dod5015.property.dod_webFileName.description=Nettfilnavn -dod_dod5015.property.dod_webPlatform.title=Nettplattform -dod_dod5015.property.dod_webPlatform.description=Nettplattform -dod_dod5015.property.dod_webSiteName.title=Nettstedsnavn -dod_dod5015.property.dod_webSiteName.description=Nettstedsnavn -dod_dod5015.property.dod_webSiteURL.title=Nettstedsadresse -dod_dod5015.property.dod_webSiteURL.description=Nettstedsadresse -dod_dod5015.property.dod_captureMethod.title=Opptaksmetode -dod_dod5015.property.dod_captureMethod.description=Opptaksmetode -dod_dod5015.property.dod_captureDate.title=Opptaksdato -dod_dod5015.property.dod_captureDate.description=Opptaksdato -dod_dod5015.property.dod_contact.title=Kontakt -dod_dod5015.property.dod_contact.description=Kontakt -dod_dod5015.property.dod_contentManagementSystem.title=Innholdsforvaltningssystem -dod_dod5015.property.dod_contentManagementSystem.description= Innholdsforvaltningssystem - diff --git a/rm-server/config/alfresco/module/org_alfresco_module_rm/dod5015/messages/dod5015_nb.properties b/rm-server/config/alfresco/module/org_alfresco_module_rm/dod5015/messages/dod5015_nb.properties deleted file mode 100644 index 2b2676732c..0000000000 --- a/rm-server/config/alfresco/module/org_alfresco_module_rm/dod5015/messages/dod5015_nb.properties +++ /dev/null @@ -1,8 +0,0 @@ -# Classified Records Capabilities -capability.group.classifiedRecords.title=Klassifiserte oppf\u00f8ringer -capability.UpdateClassificationDates.title=Oppdater klassifiseringdatoer -capability.CreateModifyDestroyClassificationGuides.title=Opprett Endre Destruer klassifiseringeveiledninger -capability.UpgradeDowngradeAndDeclassifyRecords.title=Oppgrader, last ned og deklassifiser oppf\u00f8ringer -capability.UpdateExemptionCategories.title=Oppdater unntakskategorier -capability.MapClassificationGuideMetadata.title=Koble klassifiseringsveiledning metadata -capability.CreateModifyDestroyTimeframes.title=Opprett Endre Destruer tidsrammer \ No newline at end of file diff --git a/rm-server/config/alfresco/module/org_alfresco_module_rm/extended-repository-context.xml b/rm-server/config/alfresco/module/org_alfresco_module_rm/extended-repository-context.xml index 6f589e52b4..2b10615154 100644 --- a/rm-server/config/alfresco/module/org_alfresco_module_rm/extended-repository-context.xml +++ b/rm-server/config/alfresco/module/org_alfresco_module_rm/extended-repository-context.xml @@ -5,7 +5,7 @@ - + @@ -14,14 +14,14 @@ - + - + @@ -42,7 +42,6 @@ - @@ -201,7 +200,7 @@ - + diff --git a/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/action-service_nb.properties b/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/action-service_nb.properties deleted file mode 100644 index 3bc5f998cd..0000000000 --- a/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/action-service_nb.properties +++ /dev/null @@ -1,39 +0,0 @@ -rm.action.not-defined=Oppf\u00f8ringsh\u00e5ndteringshandlingen {0} er ikke definert. -rm.action.no-implicit-noderef=Oppf\u00f8ringsh\u00e5ndteringshandlingen {0} kunne ikke utf\u00f8res fordi implementering av handlingen ikke gir implisitt nodeRef. -rm.action.record-not-declared=Disposisjonshandlingen {0} kunne ikke utf\u00f8re fordi oppf\u00f8ringen ikke er fullf\u00f8rt. (actionedUponNodeRef={1}) -rm.action.expected-record-level=Disposisjonshandlingen {0} kunne ikke utf\u00f8res fordi dette ikke er en oppf\u00f8ring. (actionedUponNodeRef={1}) -rm.action.not-all-records-declared=Disposisjonshandlingen {0} kunne ikke utf\u00f8res fordi ikke alle oppf\u00f8ringsmappene var fullf\u00f8rt. (actionedUponNodeRef={1}) -rm.action.not-eligible=Disposisjonshandlingen {0} kunne ikke utf\u00f8res fordi neste disposisjonshandling p\u00e5 oppf\u00f8ringen eller oppf\u00f8ringsmappen ikke er kvalifisert. (actionedUponNodeRef={1}) -rm.action.no-disposition-instructions=Disposisjonsh\u00e5ndlingen {0} kunne ikke utf\u00f8res fordi ingen disposisjonsinstruksjoner ble funnet. (nodeRef={1}) -rm.action.no-disposition-lisfecycle-set=Disposisjonshandlingen {0} kunne ikke utf\u00f8res fordi det ikke fantes noe tilgjengelig livssyklussett ved disposisjon. (nodeRef={1}) -rm.action.next-disp-not-set=Disposisjonshandlingen {0} kunne ikke utf\u00f8res fordi neste disposisjonshandling ikker er et sett. (nodeRef={1}) -rm.action.not-next-disp=Disposisjonshandlingen {0} kunne ikke utf\u00f8res fordi dette ikker er den neste disposisjonshandlingen til denne oppf\u00f8ringen eller oppf\u00f8ringsmappen. (nodeRef={1}) -rm.action.not-record-folder=Disposisjonshandlingen {0} kunne ikke utf\u00f8res fordi dette ikke er en oppf\u00f8ringsmappe. (nodeRef={1}) -rm.action.actioned-upon-not-record=Disposisjonshandlingen {0} kunne ikke utf\u00f8res fordi dette ikke er en oppf\u00f8ring. (filePlanComponet={1}) -rm.action.custom-aspect-not-recognised=Den tilpassede typen kan ikke brukes fordi den ikke gjenkjennes. (customAspect={0}) -rm.action.event-no-disp-lc=Hendelsen {0} kan ikke fullf\u00f8res fordi den ikke er definert p\u00e5 livssyklusen ved disposisjon. -rm.action.undeclared-only-records=Kun oppf\u00f8ringer kan fullf\u00f8res. (nodeRef={0}) -rm.action.no-declare-mand-prop=Oppf\u00f8ringen kan ikke fullf\u00f8res fordi ikke alle de obligatoriske egenskapene til oppf\u00f8ringene er stilt inn. -rm.action.ghosted-prop-update=Innholdsegenskapen til en oppf\u00f8ring som er destruert tidligere, kan ikke oppdateres. -rm.action.valid-date-disp-asof=Disposisjonshandlingen per en dato m\u00e5 v\u00e6re en gyldig dato. -rm.action.disp-asof-lifecycle-applied=Disposisjonen per en dato til en oppf\u00f8ring eller oppf\u00f8ringsmappe der en livssyklus er p\u00e5f\u00f8rt, kan ikke redigeres. -rm.action.hold-edit-reason-none=Grunnen til holdet kan ikke redigeres fordi ingen grunn er oppgitt. -rm.action.hold-edit-type=Grunnen til holdet kan ikke redigeres fordi handlingen p\u00e5 noden ikke er en type {0}. (nodeRef={1}) -rm.action.specify-avlid-date=Gjennomgangen per en dato m\u00e5 v\u00e6re en gyldig dato. -rm.action.review-details-only=Kun gjennomgangsdetaljene til sv\u00e6rt viktige oppf\u00f8ringer kan redigeres. -rm.action.freeze-no-reason=En oppf\u00f8ring kan ikke settes p\u00e5 hold uten grunn. -rm.action.freeze-only-records-folders=Kun oppf\u00f8ringer eller oppf\u00f8ringsmapper kan settes p\u00e5 hold. -rm.action.no-open-record-folder=Oppf\u00f8ringsmappen kan ikke \u00e5pnes fordi den ikke er definert som oppf\u00f8ringsmappe. (actionedUponNodeRef={0}) -rm.action.not-hold-type=Hold kunne ikke oppheves fordi noden ikke er av typen {0}. (actionedUponNodeRef={1}) -rm.action.no-read-mime-message=Mimetypemeldingen kunne ikke leses fordi {0}. -rm.action.email-declared=E-posten kunne ikke deles fordi oppf\u00f8ringen er fullf\u00f8rt. (actionedUponNodeRef={0}) -rm.action.email-not-record=E-posten kunne ikke deles fordi noden ikke er en oppf\u00f8ring. (actionedUponNodeRef={0}) -rm.action.email-create-child-assoc=Kunne ikke opprette en egendefinert barnassosiasjon. -rm.action.node-already-transfer=Noden overf\u00f8res allerede. -rm.action.node-not-transfer=Noden er ikke et overf\u00f8ringselement. -rm.action.undo-not-last=Cut off kan ikke angres fordi det ikke var cut off ved den siste disposisjonshandlingen. -rm.action.records_only_undeclared=Kun oppf\u00f8ringer kan fullf\u00f8res. -rm.action.event-not-undone=Hendelsen {0} kan ikke angres fordi den ikke er definert i livssyklusen ved disposisjon. -rm.action.node-not-record-category=Disposisjonsplanen kunne ikke opprettes fordi handlingen p\u00e5 noden ({0}) ikke var en oppf\u00f8ringskategori. -rm.action.parameter-not-supplied=Parameteren ''{0}'' er ikke satt opp. -rm.action.delete-not-hold-type=Hold kan ikke slettes fordi noden ikke er av typen {0}. (actionedUponNodeRef={1}) \ No newline at end of file diff --git a/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/action-service_ru.properties b/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/action-service_ru.properties index cb5527bdc5..64e61bff59 100644 --- a/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/action-service_ru.properties +++ b/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/action-service_ru.properties @@ -35,5 +35,5 @@ rm.action.undo-not-last=\u041d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u rm.action.records_only_undeclared=\u0422\u043e\u043b\u044c\u043a\u043e \u0437\u0430\u043f\u0438\u0441\u0438 \u043f\u043e\u0434\u043b\u0435\u0436\u0430\u0442 \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u044e. rm.action.event-not-undone=\u041d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0437\u0430\u0432\u0435\u0440\u0448\u0438\u0442\u044c \u0441\u043e\u0431\u044b\u0442\u0438\u0435 {0}: \u0441\u043e\u0431\u044b\u0442\u0438\u0435 \u043d\u0430 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043e \u0432 \u0436\u0438\u0437\u043d\u0435\u043d\u043d\u043e\u043c \u0446\u0438\u043a\u043b\u0435 \u0440\u0430\u0437\u043c\u0435\u0449\u0435\u043d\u0438\u044f. rm.action.node-not-record-category=\u041d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0413\u0440\u0430\u0444\u0438\u043a \u0440\u0430\u0437\u043c\u0435\u0449\u0435\u043d\u0438\u044f: \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0449\u0438\u0439\u0441\u044f \u043e\u0431\u044a\u0435\u043a\u0442 ({0}) \u043d\u0435 \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0441\u044f \u043a \u043a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u0438 \u0437\u0430\u043f\u0438\u0441\u0438. -rm.action.parameter-not-supplied=\u041f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 ''{0}'' \u043d\u0435 \u0443\u043a\u0430\u0437\u0430\u043d. +rm.action.parameter-not-supplied=\u041f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 \u00ab{0}\u00bb \u043d\u0435 \u0443\u043a\u0430\u0437\u0430\u043d. rm.action.delete-not-hold-type=\u041d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u043e\u0441\u0432\u043e\u0431\u043e\u0434\u0438\u0442\u044c \u0443\u0434\u0435\u0440\u0436\u0430\u043d\u0438\u0435, \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u043e\u0431\u044a\u0435\u043a\u0442 \u043d\u0435 \u043f\u0440\u0438\u043d\u0430\u0434\u043b\u0435\u0436\u0438\u0442 \u043a \u0442\u0438\u043f\u0443 {0}. (actionedUponNodeRef={1}) \ No newline at end of file diff --git a/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/actions.properties b/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/actions.properties index 94fbe11371..690be465e8 100644 --- a/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/actions.properties +++ b/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/actions.properties @@ -22,7 +22,7 @@ isRecordFiled.title=Record filed isRecordFiled.description=Is the record filed. # Are closed record folders -isRecordFolderClosed.title=Record folder closed +isRecordFolderClosed.title=Record folder closed. isRecordFolderClosed.description=Is the record folder closed. # Are vital @@ -51,10 +51,6 @@ create-record.title=Declare as record create-record.description=Declares document as a record. create-record.file-plan.display-label=File plan create-record.hide-record.display-label=Hide Record -# Declare As Version Record -declare-as-version-record.title=Declare version as record -declare-as-version-record.description=Declares new version of document as a version record. -declare-as-version-record.file-plan.display-label=File plan # Complete record declareRecord.title=Complete record declareRecord.description=Completes a record. @@ -185,17 +181,6 @@ fileReport.description=File report # Delete Hold deleteHold.title=Delete Hold deleteHold.description=Delete hold -# Move DM record -move-dm-record.title=Move record -move-dm-record.description=Move record -# Unlink from -unlinkFrom.title=Unlink from -unlinkFrom.description=Unlink from - -# Recordable version config -recordable-version-config.title=Auto-Declare Options -recordable-version-config.description=Auto-Declare Options -recordable-version-config.version.display-label=Automatically declare versions as records # Action parameter constraints rm-ac-is-kind-kinds.record_category=Record Category @@ -204,8 +189,4 @@ rm-ac-is-kind-kinds.record=Record rm-ac-disposition-action-relative-positions.next=Next rm-ac-disposition-action-relative-positions.previous=Previous -rm-ac-disposition-action-relative-positions.any=Any - -ac-versions.none=Never -ac-versions.major_only=For major versions only -ac-versions.all=For all major and minor versions \ No newline at end of file +rm-ac-disposition-action-relative-positions.any=Any \ No newline at end of file diff --git a/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/actions_de.properties b/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/actions_de.properties index 1ced1969d1..2ddc435e1d 100644 --- a/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/actions_de.properties +++ b/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/actions_de.properties @@ -6,7 +6,7 @@ isClassified.title=Nach Entsorgungsplan klassifiziert isClassified.description=Gibt an, ob die Records oder Record-Ordner durch einen Entsorgungsplan klassifiziert wurden. # Are cutoff -isCutoff.title=Trennen +isCutoff.title=Getrennt isCutoff.description=Gibt an, ob die Records oder Record-Ordner getrennt sind. # Are declared @@ -22,7 +22,7 @@ isRecordFiled.title=Record abgelegt isRecordFiled.description=Gibt an, ob der Record abgelegt ist. # Are closed record folders -isRecordFolderClosed.title=Record-Ordner geschlossen +isRecordFolderClosed.title=Record-Ordner geschlossen. isRecordFolderClosed.description=Gibt an, ob der Record-Ordner geschlossen ist. # Are vital @@ -51,10 +51,6 @@ create-record.title=Als Record deklarieren create-record.description=Deklariert das Dokument als Record. create-record.file-plan.display-label=Ablageplan create-record.hide-record.display-label=Record ausblenden -# Declare As Version Record -declare-as-version-record.title=Version als Record deklarieren -declare-as-version-record.description=Deklariert neue Version des Dokuments als Versions-Record. -declare-as-version-record.file-plan.display-label=Ablageplan # Complete record declareRecord.title=Record abschlie\u00dfen declareRecord.description=Schlie\u00dft einen Record ab. @@ -185,17 +181,6 @@ fileReport.description=Bericht ablegen # Delete Hold deleteHold.title=Sperrbereich l\u00f6schen deleteHold.description=Sperrbereich l\u00f6schen -# Move DM record -move-dm-record.title=Record verschieben -move-dm-record.description=Record verschieben -# Unlink from -unlinkFrom.title=Verkn\u00fcpfung aufheben von -unlinkFrom.description=Verkn\u00fcpfung aufheben von - -# Recordable version config -recordable-version-config.title=Optionen f\u00fcr automatische Deklaration -recordable-version-config.description=Optionen f\u00fcr automatische Deklaration -recordable-version-config.version.display-label=Versionen automatisch als Record deklarieren # Action parameter constraints rm-ac-is-kind-kinds.record_category=Record-Kategorie @@ -204,8 +189,4 @@ rm-ac-is-kind-kinds.record=Record rm-ac-disposition-action-relative-positions.next=Weiter rm-ac-disposition-action-relative-positions.previous=Vorherige -rm-ac-disposition-action-relative-positions.any=Jede - -ac-versions.none=Nie -ac-versions.major_only=Nur f\u00fcr Hauptversionen -ac-versions.all=F\u00fcr alle Haupt- und Nebenversionen +rm-ac-disposition-action-relative-positions.any=Jede \ No newline at end of file diff --git a/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/actions_es.properties b/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/actions_es.properties index 01b120e374..1cdaebd259 100644 --- a/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/actions_es.properties +++ b/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/actions_es.properties @@ -22,7 +22,7 @@ isRecordFiled.title=Documento de archivo rellenado isRecordFiled.description=El documento de archivo se ha rellenado. # Are closed record folders -isRecordFolderClosed.title=Carpeta de documentos de archivo cerrada +isRecordFolderClosed.title=Carpeta de documentos de archivo cerrada. isRecordFolderClosed.description=La carpeta de documentos de archivo est\u00e1 cerrada. # Are vital @@ -31,7 +31,7 @@ isVital.description=El documento de archivo o la carpeta de documentos de archiv # Have Disposition Action hasDispositionAction.title=Tiene acci\u00f3n de disposici\u00f3n -hasDispositionAction.description=Hace que los nodos tengan la acci\u00f3n de disposici\u00f3n asociada especificada en la posici\u00f3n relativa especificada. +hasDispositionAction.description=Hacer que los nodos tengan la acci\u00f3n de disposici\u00f3n asociada especificada en la posici\u00f3n relativa especificada. # Are kind isKind.title=Tipo de elemento de gesti\u00f3n de documentos de archivo @@ -51,10 +51,6 @@ create-record.title=Declarar como documento de archivo create-record.description=Declara el documento como un documento de archivo. create-record.file-plan.display-label=Plan de ficheros create-record.hide-record.display-label=Ocultar documento de archivo -# Declare As Version Record -declare-as-version-record.title=Declarar versi\u00f3n como documento de archivo -declare-as-version-record.description=Declara la nueva versi\u00f3n del documento como documento de archivo versionado. -declare-as-version-record.file-plan.display-label=Plan de ficheros # Complete record declareRecord.title=Documento de archivo completo declareRecord.description=Completa un documento de archivo. @@ -82,26 +78,26 @@ unfreeze.description=Descongela un documento de archivo. fileTo.title=Archivar en fileTo.description=Archiva un documento de archivo en la carpeta de documentos de archivo especificada. fileTo.path.display-label=Ruta a la carpeta de documentos de archivo -fileTo.createRecordPath.display-label=Crea una ruta a los documentos de archivo +fileTo.createRecordPath.display-label=Crear ruta de documentos de archivo # Copy to copyTo.title=Copiar a copyTo.description=Copia un documento de archivo en la carpeta de documentos de archivo especificada. copyTo.path.display-label=Ruta a la carpeta de documentos de archivo -copyTo.createRecordPath.display-label=Crea una ruta a la carpeta de documentos de archivo +copyTo.createRecordPath.display-label=Crear ruta de documentos de archivo # Move to moveTo.title=Mover a moveTo.description=Mueve un documento de archivo en la carpeta de documentos de archivo especificada. moveTo.path.display-label=Ruta a la carpeta de documentos de archivo -moveTo.createRecordPath.display-label=Crea una ruta a los documentos de archivo +moveTo.createRecordPath.display-label=Crear ruta de documentos de archivo # Link to linkTo.title=Enlace a linkTo.description=Enlaza un documento de archivo a la carpeta de documentos de archivo especificada. linkTo.path.display-label=Ruta a la carpeta de documentos de archivo -linkTo.createRecordPath.display-label=Crea una ruta a la carpeta de documentos de archivo +linkTo.createRecordPath.display-label=Crear ruta de documentos de archivo # Reject reject.title=Rechazar reject.description=Rechaza un documento de archivo y mueve el documento a su ubicaci\u00f3n original -reject.reason.display-label=Rechaza la raz\u00f3n +reject.reason.display-label=Rechazar raz\u00f3n # Request Information requestInfo.title=Solicitar informaci\u00f3n requestInfo.description=Inicia un flujo de trabajo para solicitar m\u00e1s informaci\u00f3n para un documento de archivo @@ -118,25 +114,25 @@ setPropertyValue.description=Establece un valor de la propiedad # Edit Hold Reason editHoldReason.title=Editar raz\u00f3n de bloqueo -editHoldReason.description=Edita la raz\u00f3n de bloqueo +editHoldReason.description=Editar raz\u00f3n de bloqueo # Relinquish Hold relinquishHold.title=Eliminar bloqueo -relinquishHold.description=Elimina el bloqueo +relinquishHold.description=Eliminar bloqueo # Edit Review As Of Date editReviewAsOfDate.title=Editar fecha de inicio de revisi\u00f3n -editReviewAsOfDate.description=Edita la fecha de inicio de revisi\u00f3n +editReviewAsOfDate.description=Editar fecha de inicio de revisi\u00f3n # Edit Disposition Action As Of Date editDispositionActionAsOfDate.title=Editar fecha de inicio de acci\u00f3n de disposici\u00f3n -editDispositionActionAsOfDate.description=Edita la fecha de inicio de acci\u00f3n de disposici\u00f3n +editDispositionActionAsOfDate.description=Editar fecha de inicio de acci\u00f3n de disposici\u00f3n # Broadcast Vital Record Definition broadcastVitalRecordDefinition.title=Difundir definici\u00f3n de documento de archivo vital -broadcastVitalRecordDefinition.description=Difunde la definici\u00f3n de documento de archivo vital +broadcastVitalRecordDefinition.description=Difundir definici\u00f3n de documento de archivo vital # Broadcast Disposition Action Definition Update broadcastDispositionActionDefinitionUpdate.title=Difundir definici\u00f3n de acciones de disposici\u00f3n -broadcastDispositionActionDefinitionUpdate.description=Difunde la definici\u00f3n de acciones de disposici\u00f3n +broadcastDispositionActionDefinitionUpdate.description=Difundir definici\u00f3n de acciones de disposici\u00f3n # Undo Event undoEvent.title=Deshacer evento -undoEvent.description=Deshace el evento +undoEvent.description=Deshacer evento # Transfer Complete transferComplete.title=Transferencia completa transferComplete.description=Transferencia completa @@ -145,13 +141,13 @@ accessionComplete.title=Adhesi\u00f3n completa accessionComplete.description=Adhesi\u00f3n completa # Split Email splitEmail.title=Separar correo electr\u00f3nico -splitEmail.description=Separa el correo electr\u00f3nico +splitEmail.description=Separar correo electr\u00f3nico # Create Disposition Schedule createDispositionSchedule.title=Crear planificaci\u00f3n de disposici\u00f3n -createDispositionSchedule.description=Creaa la planificaci\u00f3n de disposici\u00f3n +createDispositionSchedule.description=Crear planificaci\u00f3n de disposici\u00f3n # File Destruction Report fileDestructionReport.title=Archivar informe de destrucci\u00f3n -fileDestructionReport.description=Archiva el informe de destrucci\u00f3n +fileDestructionReport.description=Archivar informe de destrucci\u00f3n # Cut off cutoff.title=Interrumpir cutoff.description=Interrumpir @@ -163,13 +159,13 @@ reviewed.title=Revisado reviewed.description=Revisado # Hide Record hide-record.title=Ocultar documento de archivo -hide-record.description=Oculta el documento de archivo +hide-record.description=Ocultar documento de archivo # Transfer transfer.title=Transferencia transfer.description=Transferencia # Uncut off unCutoff.title=Deshacer interrupci\u00f3n -unCutoff.description=Deshace la interrupci\u00f3n +unCutoff.description=Deshacer interrupci\u00f3n # Accession accession.title=Adhesi\u00f3n accession.description=Adhesi\u00f3n @@ -181,21 +177,10 @@ addRecordTypes.title=A\u00f1adir tipos de documento de archivo addRecordTypes.description=A\u00f1ade los tipos seleccionados al documento de archivo # File report fileReport.title=Archivar informe -fileReport.description=Archiva el informe +fileReport.description=Archivar informe # Delete Hold deleteHold.title=Eliminar bloqueo -deleteHold.description=Elimina el bloqueo -# Move DM record -move-dm-record.title=Mover documento de archivo -move-dm-record.description=Mueve el documento de archivo -# Unlink from -unlinkFrom.title=Desvincular de -unlinkFrom.description=De donde se desvincula - -# Recordable version config -recordable-version-config.title=Opciones de declaraci\u00f3n autom\u00e1tica -recordable-version-config.description=Opciones de declaraci\u00f3n autom\u00e1tica -recordable-version-config.version.display-label=Declarar autom\u00e1ticamente versiones como documentos de archivo +deleteHold.description=Eliminar bloqueo # Action parameter constraints rm-ac-is-kind-kinds.record_category=Categor\u00eda de documentos de archivo @@ -204,8 +189,4 @@ rm-ac-is-kind-kinds.record=Documento de archivo rm-ac-disposition-action-relative-positions.next=Siguiente rm-ac-disposition-action-relative-positions.previous=Anterior -rm-ac-disposition-action-relative-positions.any=Cualquiera - -ac-versions.none=Nunca -ac-versions.major_only=Solo para versiones mayores -ac-versions.all=Para todas las versiones mayores y menores \ No newline at end of file +rm-ac-disposition-action-relative-positions.any=Cualquiera \ No newline at end of file diff --git a/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/actions_fr.properties b/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/actions_fr.properties index e616c312c6..ae15d9e812 100644 --- a/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/actions_fr.properties +++ b/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/actions_fr.properties @@ -22,7 +22,7 @@ isRecordFiled.title=Document d'archives archiv\u00e9 isRecordFiled.description=Est le document d'archives archiv\u00e9. # Are closed record folders -isRecordFolderClosed.title=Dossier d'archives ferm\u00e9 +isRecordFolderClosed.title=Dossier d'archives ferm\u00e9. isRecordFolderClosed.description=Est le dossier d'archives ferm\u00e9. # Are vital @@ -51,10 +51,6 @@ create-record.title=D\u00e9clarer comme document d'archives create-record.description=D\u00e9clare un document comme document d'archives create-record.file-plan.display-label=Plan de classification create-record.hide-record.display-label=Masquer le document d'archives -# Declare As Version Record -declare-as-version-record.title=D\u00e9clarer la version comme document d'archives -declare-as-version-record.description=D\u00e9clare la nouvelle version d'un document comme document d'archive versionn\u00e9. -declare-as-version-record.file-plan.display-label=Plan de classification # Complete record declareRecord.title=Compl\u00e9ter un document d'archives declareRecord.description=Compl\u00e8te un document d'archives. @@ -70,7 +66,7 @@ closeRecordFolder.description=Ferme un dossier d'archives. # Complete event completeEvent.title=Compl\u00e9ter un \u00e9v\u00e9nement completeEvent.description=Compl\u00e8te un \u00e9v\u00e9nement. -completeEvent.eventName.display-label=Ev\u00e9nement +completeEvent.eventName.display-label=\u00c9v\u00e9nement # Freeze freeze.title=Geler freeze.description=G\u00e8le un document d'archives. @@ -183,19 +179,8 @@ addRecordTypes.description=Ajoute le(s) type(s) s\u00e9lectionn\u00e9(s) au docu fileReport.title=Archiver le rapport fileReport.description=Archiver le rapport # Delete Hold -deleteHold.title=Supprimer la suspension -deleteHold.description=Supprimer la suspension -# Move DM record -move-dm-record.title=D\u00e9placer le document d'archives -move-dm-record.description=D\u00e9placer le document d'archives -# Unlink from -unlinkFrom.title=Supprimer le lien de -unlinkFrom.description=Supprimer le lien de - -# Recordable version config -recordable-version-config.title=Options de d\u00e9claration automatique -recordable-version-config.description=Options de d\u00e9claration automatique -recordable-version-config.version.display-label=D\u00e9clarer automatiquement les versions comme documents d'archives +deleteHold.title=\u5220\u9664\u4fdd\u5b58 +deleteHold.description=\u5220\u9664\u4fdd\u5b58 # Action parameter constraints rm-ac-is-kind-kinds.record_category=Cat\u00e9gorie de document d'archives @@ -204,8 +189,4 @@ rm-ac-is-kind-kinds.record=Document d'archives rm-ac-disposition-action-relative-positions.next=Suivant rm-ac-disposition-action-relative-positions.previous=Pr\u00e9c\u00e9dent -rm-ac-disposition-action-relative-positions.any=N'importe lequel - -ac-versions.none=Jamais -ac-versions.major_only=Uniquement les versions majeures -ac-versions.all=Versions majeures et mineures \ No newline at end of file +rm-ac-disposition-action-relative-positions.any=N'importe lequel \ No newline at end of file diff --git a/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/actions_it.properties b/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/actions_it.properties index 7be12306a2..896f60c869 100644 --- a/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/actions_it.properties +++ b/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/actions_it.properties @@ -11,36 +11,36 @@ isCutoff.description=Record o cartelle di record separati. # Are declared isDeclared.title=Record completati -isDeclared.description=Il record \u00e8 completo +isDeclared.description=Il record \u00e8 completo? # Is on hold isFrozen.title=Sospeso -isFrozen.description=Il record o la cartella di record sono in sospeso +isFrozen.description=Il record o la cartella di record sono in sospeso? # Are filed isRecordFiled.title=Record archiviato -isRecordFiled.description=Il record \u00e8 archiviato +isRecordFiled.description=Il record \u00e8 archiviato? # Are closed record folders -isRecordFolderClosed.title=Cartella di record chiusa -isRecordFolderClosed.description=La cartella di record \u00e8 chiusa +isRecordFolderClosed.title=Cartella di record chiusa. +isRecordFolderClosed.description=La cartella di record \u00e8 chiusa? # Are vital isVital.title=Record fondamentale -isVital.description=Il record o la cartella di record sono fondamentali +isVital.description=Il record o la cartella di record sono fondamentali? # Have Disposition Action hasDispositionAction.title=Possiede l'azione di disposizione -hasDispositionAction.description=I nodi hanno ottenuto la relativa azione di disposizione specificata alla relativa posizione specificata +hasDispositionAction.description=I nodi hanno ottenuto la relativa azione di disposizione specificata alla relativa posizione specificata? # Are kind isKind.title=Tipo di elemento di gestione dei record -isKind.description=I nodi sono del tipo componente piano file +isKind.description=I nodi sono del tipo componente piano file? isKind.kind.display-label=Tipo # Are Record Type isRecordType.title=Possiede tipo di record -isRecordType.description=I record sono del tipo specificato +isRecordType.description=I record sono del tipo specificato? # @@ -51,10 +51,6 @@ create-record.title=Dichiara come record create-record.description=Dichiara documento come record. create-record.file-plan.display-label=Piano file create-record.hide-record.display-label=Nascondi record -# Declare As Version Record -declare-as-version-record.title=Dichiara versione come record -declare-as-version-record.description=Dichiara la nuova versione del documento come record versione. -declare-as-version-record.file-plan.display-label=Piano file # Complete record declareRecord.title=Completa record declareRecord.description=Completa un record. @@ -185,17 +181,6 @@ fileReport.description=Archivia Report # Delete Hold deleteHold.title=Annulla sospensione deleteHold.description=Annulla sospensione -# Move DM record -move-dm-record.title=Sposta record -move-dm-record.description=Sposta record -# Unlink from -unlinkFrom.title=Scollega da -unlinkFrom.description=Scollega da - -# Recordable version config -recordable-version-config.title=Opzioni di dichiarazione automatica -recordable-version-config.description=Opzioni di dichiarazione automatica -recordable-version-config.version.display-label=Dichiara automaticamente versioni come record # Action parameter constraints rm-ac-is-kind-kinds.record_category=Categoria record @@ -204,8 +189,4 @@ rm-ac-is-kind-kinds.record=Record rm-ac-disposition-action-relative-positions.next=Successivo rm-ac-disposition-action-relative-positions.previous=Precedente -rm-ac-disposition-action-relative-positions.any=Qualsiasi - -ac-versions.none=Mai -ac-versions.major_only=Solo per versioni maggiori -ac-versions.all=Per tutte le versioni maggiori e minori \ No newline at end of file +rm-ac-disposition-action-relative-positions.any=Qualsiasi \ No newline at end of file diff --git a/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/actions_ja.properties b/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/actions_ja.properties index 3b1339298c..d0966eb080 100644 --- a/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/actions_ja.properties +++ b/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/actions_ja.properties @@ -22,7 +22,7 @@ isRecordFiled.title=\u30ec\u30b3\u30fc\u30c9\u6574\u7406\u4fdd\u7ba1\u6e08\u307f isRecordFiled.description=\u30ec\u30b3\u30fc\u30c9\u306f\u6574\u7406\u4fdd\u7ba1\u3055\u308c\u3066\u3044\u307e\u3059\u304b\u3002 # Are closed record folders -isRecordFolderClosed.title=\u30ec\u30b3\u30fc\u30c9\u30d5\u30a9\u30eb\u30c0\u306f\u9589\u3058\u3089\u308c\u3066\u3044\u307e\u3059 +isRecordFolderClosed.title=\u30ec\u30b3\u30fc\u30c9\u30d5\u30a9\u30eb\u30c0\u306f\u9589\u3058\u3089\u308c\u3066\u3044\u307e\u3059\u3002 isRecordFolderClosed.description=\u30ec\u30b3\u30fc\u30c9\u30d5\u30a9\u30eb\u30c0\u306f\u9589\u3058\u3089\u308c\u3066\u3044\u307e\u3059\u304b\u3002 # Are vital @@ -51,10 +51,6 @@ create-record.title=\u30ec\u30b3\u30fc\u30c9\u3068\u3057\u3066\u5ba3\u8a00\u3059 create-record.description=\u6587\u66f8\u3092\u30ec\u30b3\u30fc\u30c9\u3068\u3057\u3066\u5ba3\u8a00\u3057\u307e\u3059\u3002 create-record.file-plan.display-label=\u30d5\u30a1\u30a4\u30eb\u30d7\u30e9\u30f3 create-record.hide-record.display-label=\u30ec\u30b3\u30fc\u30c9\u3092\u975e\u8868\u793a\u306b\u3059\u308b -# Declare As Version Record -declare-as-version-record.title=\u30d0\u30fc\u30b8\u30e7\u30f3\u3092\u30ec\u30b3\u30fc\u30c9\u3068\u3057\u3066\u5ba3\u8a00\u3059\u308b -declare-as-version-record.description=\u6587\u66f8\u306e\u65b0\u3057\u3044\u30d0\u30fc\u30b8\u30e7\u30f3\u3092\u30d0\u30fc\u30b8\u30e7\u30f3\u30ec\u30b3\u30fc\u30c9\u3068\u3057\u3066\u5ba3\u8a00\u3057\u307e\u3059\u3002 -declare-as-version-record.file-plan.display-label=\u30d5\u30a1\u30a4\u30eb\u30d7\u30e9\u30f3 # Complete record declareRecord.title=\u5b8c\u4e86\u30ec\u30b3\u30fc\u30c9 declareRecord.description=\u30ec\u30b3\u30fc\u30c9\u3092\u5b8c\u4e86\u3057\u307e\u3059\u3002 @@ -109,6 +105,10 @@ requestInfo.description=\u30ec\u30b3\u30fc\u30c9\u306e\u8a73\u7d30\u60c5\u5831\u executeScript.title=\u30b9\u30af\u30ea\u30d7\u30c8\u306e\u5b9f\u884c executeScript.description=\u30b9\u30af\u30ea\u30d7\u30c8\u3092\u5b9f\u884c\u3057\u307e\u3059\u3002 executeScript.script-ref.display-label=\u30b9\u30af\u30ea\u30d7\u30c8 +# Delete Hold +deleteHold.title=\u30db\u30fc\u30eb\u30c9\u306e\u524a\u9664 +deleteHold.description=\u30db\u30fc\u30eb\u30c9\u306e\u524a\u9664 + # Send Email sendEmail.title=E\u30e1\u30fc\u30eb\u3092\u9001\u4fe1\u3059\u308b sendEmail.description=E\u30e1\u30fc\u30eb\u3092\u9001\u4fe1\u3059\u308b @@ -182,20 +182,6 @@ addRecordTypes.description=\u9078\u629e\u3057\u305f\u30bf\u30a4\u30d7\u3092\u30e # File report fileReport.title=\u30ec\u30dd\u30fc\u30c8\u306e\u6574\u7406\u4fdd\u7ba1 fileReport.description=\u30ec\u30dd\u30fc\u30c8\u306e\u6574\u7406\u4fdd\u7ba1 -# Delete Hold -deleteHold.title=\u30db\u30fc\u30eb\u30c9\u306e\u524a\u9664 -deleteHold.description=\u30db\u30fc\u30eb\u30c9\u306e\u524a\u9664 -# Move DM record -move-dm-record.title=\u30ec\u30b3\u30fc\u30c9\u306e\u79fb\u52d5 -move-dm-record.description=\u30ec\u30b3\u30fc\u30c9\u306e\u79fb\u52d5 -# Unlink from -unlinkFrom.title=\u30ea\u30f3\u30af\u306e\u89e3\u9664\u5143 -unlinkFrom.description=\u30ea\u30f3\u30af\u306e\u89e3\u9664\u5143 - -# Recordable version config -recordable-version-config.title=\u81ea\u52d5\u5ba3\u8a00\u30aa\u30d7\u30b7\u30e7\u30f3 -recordable-version-config.description=\u81ea\u52d5\u5ba3\u8a00\u30aa\u30d7\u30b7\u30e7\u30f3 -recordable-version-config.version.display-label=\u30d0\u30fc\u30b8\u30e7\u30f3\u3092\u81ea\u52d5\u7684\u306b\u30ec\u30b3\u30fc\u30c9\u3068\u3057\u3066\u5ba3\u8a00\u3059\u308b # Action parameter constraints rm-ac-is-kind-kinds.record_category=\u30ec\u30b3\u30fc\u30c9\u30ab\u30c6\u30b4\u30ea @@ -204,8 +190,4 @@ rm-ac-is-kind-kinds.record=\u30ec\u30b3\u30fc\u30c9 rm-ac-disposition-action-relative-positions.next=\u6b21\u3078 rm-ac-disposition-action-relative-positions.previous=\u524d\u3078 -rm-ac-disposition-action-relative-positions.any=\u4efb\u610f - -ac-versions.none=\u5ba3\u8a00\u3057\u306a\u3044 -ac-versions.major_only=\u30e1\u30b8\u30e3\u30fc\u30d0\u30fc\u30b8\u30e7\u30f3\u306e\u307f -ac-versions.all=\u3059\u3079\u3066\u306e\u30e1\u30b8\u30e3\u30fc\u30d0\u30fc\u30b8\u30e7\u30f3\u3068\u30de\u30a4\u30ca\u30fc\u30d0\u30fc\u30b8\u30e7\u30f3 \ No newline at end of file +rm-ac-disposition-action-relative-positions.any=\u4efb\u610f \ No newline at end of file diff --git a/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/actions_nb.properties b/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/actions_nb.properties deleted file mode 100644 index 061f6fd610..0000000000 --- a/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/actions_nb.properties +++ /dev/null @@ -1,211 +0,0 @@ -# -# i18n for Records Management Action Conditions -# -# Are classified -isClassified.title=Klassifisert etter disposisjonsplan -isClassified.description=Har oppf\u00f8ringene og oppf\u00f8ringsmappene blitt klassifisert etter en disposisjonsplan. - -# Are cutoff -isCutoff.title=Cut off -isCutoff.description=Cut off av oppf\u00f8ringer og oppf\u00f8ringersmapper. - -# Are declared -isDeclared.title=Oppf\u00f8ring fullf\u00f8rt -isDeclared.description=Er oppf\u00f8ringen fullf\u00f8rt. - -# Is on hold -isFrozen.title=P\u00e5 hold -isFrozen.description=Er oppf\u00f8ringen eller oppf\u00f8ringsmappen p\u00e5 hold. - -# Are filed -isRecordFiled.title=Oppf\u00f8ring registrert -isRecordFiled.description=Oppf\u00f8ringen er registrert. - -# Are closed record folders -isRecordFolderClosed.title=Oppf\u00f8ringsmappe lukket -isRecordFolderClosed.description=Er oppf\u00f8ringsmappen lukket. - -# Are vital -isVital.title=Sv\u00e6rt viktig oppf\u00f8ring -isVital.description=Er oppf\u00f8ringen eller oppf\u00f8ringsmappen sv\u00e6rt viktig. - -# Have Disposition Action -hasDispositionAction.title=Har disposisjonshandling -hasDispositionAction.description=Har nodene de spesifikke assosierte disposisjonshandlingen p\u00e5 den spesifiserte relative posisjonen. - -# Are kind -isKind.title=Type element ved oppf\u00f8ringsh\u00e5ndtering -isKind.description=Er nodene av typen filplandel. -isKind.kind.display-label=Type - -# Are Record Type -isRecordType.title=Har oppf\u00f8ringstype -isRecordType.description=Er oppf\u00f8ringene av den spesifikke typen. - - -# -# i18n for Records Management Actions -# -# Declare As Record -create-record.title=Erkl\u00e6r som oppf\u00f8ring -create-record.description=Erkl\u00e6rer dokumentet som oppf\u00f8ring. -create-record.file-plan.display-label=Filplan -create-record.hide-record.display-label=Skjul oppf\u00f8ring -# Declare As Version Record -declare-as-version-record.title=Erkl\u00e6r versjon som oppf\u00f8ring -declare-as-version-record.description=Erkl\u00e6rer ny versjon av dokument som en versjonsoppf\u00f8ring. -declare-as-version-record.file-plan.display-label=Filplan -# Complete record -declareRecord.title=Fullf\u00f8r oppf\u00f8ring -declareRecord.description=Fullf\u00f8rer en oppf\u00f8ring. -# Reopens record -undeclareRecord.title=\u00c5pne oppf\u00f8ring p\u00e5 nytt -undeclareRecord.description=\u00c5pner en oppf\u00f8ring p\u00e5 nytt. -# Open record folder -openRecordFolder.title=\u00c5pne oppf\u00f8ringsmappe -openRecordFolder.description=\u00c5pner en oppf\u00f8ringsmappe. -# Close record folder -closeRecordFolder.title=Lukk oppf\u00f8ringsmappe -closeRecordFolder.description=Lukker en oppf\u00f8ringsmappe. -# Complete event -completeEvent.title=Fullf\u00f8r hendelse -completeEvent.description=Fullf\u00f8rer en hendelse. -completeEvent.eventName.display-label=Hendelse -# Freeze -freeze.title=Frys -freeze.description=Fryser en oppf\u00f8ring. -freeze.reason.display-label=Grunn -# Unfreeze -unfreeze.title=T\u00f8 opp -unfreeze.description=T\u00f8r opp en oppf\u00f8ring. -# File to -fileTo.title=Arkiver i -fileTo.description=En oppf\u00f8ring arkiveres i en bestemt oppf\u00f8ringsmappe. -fileTo.path.display-label=Bane til oppf\u00f8ringsmappe -fileTo.createRecordPath.display-label=Opprett oppf\u00f8ringsbane -# Copy to -copyTo.title=Kopier til -copyTo.description=En oppf\u00f8ring kopieres i en bestemt oppf\u00f8ringsmappe. -copyTo.path.display-label=Bane til oppf\u00f8ringsmappe -copyTo.createRecordPath.display-label=Opprett oppf\u00f8ringsbane -# Move to -moveTo.title=Flytt til -moveTo.description=En oppf\u00f8ring flyttes til i en bestemt oppf\u00f8ringsmappe. -moveTo.path.display-label=Bane til oppf\u00f8ringsmappe -moveTo.createRecordPath.display-label=Opprett oppf\u00f8ringsbane -# Link to -linkTo.title=Koble til -linkTo.description=En oppf\u00f8ring kobles til i en bestemt oppf\u00f8ringsmappe. -linkTo.path.display-label=Bane til oppf\u00f8ringsmappe -linkTo.createRecordPath.display-label=Opprett oppf\u00f8ringsbane -# Reject -reject.title=Avvis -reject.description=En oppf\u00f8ring avvises, og dokumentet flyttes til det opprinnelige stedet -reject.reason.display-label=\u00c5rsak til avvisning -# Request Information -requestInfo.title=Be om informasjon -requestInfo.description=Starter en arbeidsflyt for \u00e5 be om mer informasjon om en oppf\u00f8ring -# Execute script -executeScript.title=Kj\u00f8r skript -executeScript.description=Kj\u00f8r et skript. -executeScript.script-ref.display-label=Skript -# Send Email -sendEmail.title=Send e-post -sendEmail.description=Send en e-post -# Set Property -setPropertyValue.title=Still inn egenskapsverdi -setPropertyValue.description=Still inn en egenskapsverdi - -# Edit Hold Reason -editHoldReason.title=Rediger grunn til holdet -editHoldReason.description=Rediger grunn til holdet -# Relinquish Hold -relinquishHold.title=Avslutt hold -relinquishHold.description=Avslutt hold -# Edit Review As Of Date -editReviewAsOfDate.title=Rediger gjennomgang per datoen -editReviewAsOfDate.description=Rediger gjennomgang per datoen -# Edit Disposition Action As Of Date -editDispositionActionAsOfDate.title=Rediger disposisjonshandling per datoen -editDispositionActionAsOfDate.description=Rediger disposisjonshandling per datoen -# Broadcast Vital Record Definition -broadcastVitalRecordDefinition.title=Kringkast definisjonen til sv\u00e6rt viktig oppf\u00f8ring -broadcastVitalRecordDefinition.description=Kringkast definisjonen til sv\u00e6rt viktig oppf\u00f8ring -# Broadcast Disposition Action Definition Update -broadcastDispositionActionDefinitionUpdate.title=Kringkast oppdatering av definisjonen til disposisjonshandling -broadcastDispositionActionDefinitionUpdate.description=Kringkast oppdatering av definisjonen til disposisjonshandling -# Undo Event -undoEvent.title=Angre hendelse -undoEvent.description=Angre hendelse -# Transfer Complete -transferComplete.title=Overf\u00f8r fullf\u00f8rt -transferComplete.description=Overf\u00f8r fullf\u00f8rt -# Accession Complete -accessionComplete.title=Tilgang fullf\u00f8rt -accessionComplete.description=Tilgang fullf\u00f8rt -# Split Email -splitEmail.title=Delt e-post -splitEmail.description=Delt e-post -# Create Disposition Schedule -createDispositionSchedule.title=Opprett disposisjonsplan -createDispositionSchedule.description=Opprett disposisjonsplan -# File Destruction Report -fileDestructionReport.title=Fildestruksjonsrapport -fileDestructionReport.description=Fildestruksjonsrapport -# Cut off -cutoff.title=Cut off -cutoff.description=Cut off -# Destroy -destroy.title=Destruer -destroy.description=Destruer -# Reviewed -reviewed.title=Gjennomg\u00e5tt -reviewed.description=Gjennomg\u00e5tt -# Hide Record -hide-record.title=Skjul oppf\u00f8ring -hide-record.description=Skjul oppf\u00f8ring -# Transfer -transfer.title=Overf\u00f8r -transfer.description=Overf\u00f8r -# Uncut off -unCutoff.title=Angre cut off -unCutoff.description=Angre cut off -# Accession -accession.title=Tilgang -accession.description=Tilgang -# Retain -retain.title=Behold -retain.description=Behold -# Add Record Types -addRecordTypes.title=Legg til oppf\u00f8ringstyper -addRecordTypes.description=Legger valgt(e) type(r) til oppf\u00f8ringen -# File report -fileReport.title=Registrer rapport -fileReport.description=Registrer rapport -# Delete Hold -deleteHold.title=Slett hold -deleteHold.description=Slett hold -# Move DM record -move-dm-record.title=Flytt oppf\u00f8ring -move-dm-record.description=Flytt oppf\u00f8ring -# Unlink from -unlinkFrom.title=Koble fra -unlinkFrom.description=Koble fra - -# Recordable version config -recordable-version-config.title=Alternativer med automatiske erkl\u00e6ringer -recordable-version-config.description=Alternativer med automatiske erkl\u00e6ringer -recordable-version-config.version.display-label=Erkl\u00e6rer alternativene med automatiske erkl\u00e6ringer som oppf\u00f8ringer - -# Action parameter constraints -rm-ac-is-kind-kinds.record_category=Oppf\u00f8ringskategori -rm-ac-is-kind-kinds.record_folder=Oppf\u00f8ringsmappe -rm-ac-is-kind-kinds.record=Oppf\u00f8ring - -rm-ac-disposition-action-relative-positions.next=Neste -rm-ac-disposition-action-relative-positions.previous=Forrige -rm-ac-disposition-action-relative-positions.any=Enhver - -ac-versions.none=Aldri -ac-versions.major_only=Kun hovedversjoner -ac-versions.all=Til alle hovedversjoner og mindre versjoner \ No newline at end of file diff --git a/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/actions_nl.properties b/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/actions_nl.properties index 96670bb10c..53e5d8ee6e 100755 --- a/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/actions_nl.properties +++ b/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/actions_nl.properties @@ -2,8 +2,8 @@ # i18n for Records Management Action Conditions # # Are classified -isClassified.title=Geclassificeerd op beschikkingsschema -isClassified.description=De records of archiefmappen zijn geclassificeerd op basis van een beschikkingsschema +isClassified.title=Geclassificeerd op bewaarschema +isClassified.description=Zijn de records of archiefmappen geclassificeerd op een bewaarschema? # Are cutoff isCutoff.title=Afsluiten @@ -11,36 +11,36 @@ isCutoff.description=Records of archiefmappen zijn afgesloten. # Are declared isDeclared.title=Record afgerond -isDeclared.description=De record is afgerond +isDeclared.description=Is de record afgerond? # Is on hold isFrozen.title=In wachtstand -isFrozen.description=De record of de archiefmap bevindt zich in de wachtstand +isFrozen.description=Is de record of de archiefmap in wachtstand? # Are filed isRecordFiled.title=Record gearchiveerd -isRecordFiled.description=De record is gearchiveerd +isRecordFiled.description=Is de record gearchiveerd? # Are closed record folders -isRecordFolderClosed.title=Archiefmap gesloten -isRecordFolderClosed.description=De archiefmap is gesloten +isRecordFolderClosed.title=Archiefmap gesloten. +isRecordFolderClosed.description=Is de archiefmap gesloten? # Are vital isVital.title=Vitale record -isVital.description=De record of de archiefmap is vitaal +isVital.description=Is de record of de archiefmap vitaal? # Have Disposition Action -hasDispositionAction.title=Heeft beschikkingsactie -hasDispositionAction.description=De nodes hebben de opgegeven gekoppelde beschikkingsactie op de opgegeven relatieve positie +hasDispositionAction.title=Heeft archiveringsactie +hasDispositionAction.description=Hebben de nodes de opgegeven gekoppelde archiveringsactie op de opgegeven relatieve positie? # Are kind isKind.title=Type onderdeel Record Management -isKind.description=De nodes zijn van een type ordeningsplancomponent +isKind.description=Zijn de nodes van een type ordeningsplancomponent? isKind.kind.display-label=Type # Are Record Type isRecordType.title=Heeft recordtype -isRecordType.description=De records zijn van het opgegeven type +isRecordType.description=Zijn de records van het opgegeven type? # @@ -48,13 +48,9 @@ isRecordType.description=De records zijn van het opgegeven type # # Declare As Record create-record.title=Declareren als record -create-record.description=Hiermee wordt een document gedeclareerd als een record. +create-record.description=Declareert document als een record. create-record.file-plan.display-label=Ordeningsplan create-record.hide-record.display-label=Record verbergen -# Declare As Version Record -declare-as-version-record.title=Versie declareren als record -declare-as-version-record.description=Hiermee wordt een nieuwe versie van een document gedeclareerd als een versierecord. -declare-as-version-record.file-plan.display-label=Ordeningsplan # Complete record declareRecord.title=Record afronden declareRecord.description=Hiermee wordt een record afgerond. @@ -126,14 +122,14 @@ relinquishHold.description=Wachtstand afwijzen editReviewAsOfDate.title=Begindatum revisie bewerken editReviewAsOfDate.description=Begindatum revisie bewerken # Edit Disposition Action As Of Date -editDispositionActionAsOfDate.title=Begindatum beschikkingsactie bewerken -editDispositionActionAsOfDate.description=Begindatum beschikkingsactie bewerken +editDispositionActionAsOfDate.title=Begindatum archiveringsactie bewerken +editDispositionActionAsOfDate.description=Begindatum archiveringsactie bewerken # Broadcast Vital Record Definition broadcastVitalRecordDefinition.title=Definitie vitale record uitzenden broadcastVitalRecordDefinition.description=Definitie vitale record uitzenden # Broadcast Disposition Action Definition Update -broadcastDispositionActionDefinitionUpdate.title=Update van definitie beschikkingsactie uitzenden -broadcastDispositionActionDefinitionUpdate.description=Update van definitie beschikkingsactie uitzenden +broadcastDispositionActionDefinitionUpdate.title=Update van definitie archiveringsactie uitzenden +broadcastDispositionActionDefinitionUpdate.description=Update van definitie archiveringsactie uitzenden # Undo Event undoEvent.title=Gebeurtenis ongedaan maken undoEvent.description=Gebeurtenis ongedaan maken @@ -147,8 +143,8 @@ accessionComplete.description=Overdracht afgerond splitEmail.title=E-mail opsplitsen splitEmail.description=E-mail opsplitsen # Create Disposition Schedule -createDispositionSchedule.title=Beschikkingsschema maken -createDispositionSchedule.description=Beschikkingsschema maken +createDispositionSchedule.title=Bewaarschema maken +createDispositionSchedule.description=Bewaarschema maken # File Destruction Report fileDestructionReport.title=Vernietigingsrapport archiveren fileDestructionReport.description=Vernietigingsrapport archiveren @@ -185,17 +181,6 @@ fileReport.description=Rapport archiveren # Delete Hold deleteHold.title=Wachtstand verwijderen deleteHold.description=Wachtstand verwijderen -# Move DM record -move-dm-record.title=Record verplaatsen -move-dm-record.description=Record verplaatsen -# Unlink from -unlinkFrom.title=Koppeling opheffen met -unlinkFrom.description=Koppeling opheffen met - -# Recordable version config -recordable-version-config.title=Opties voor automatisch declareren -recordable-version-config.description=Opties voor automatisch declareren -recordable-version-config.version.display-label=Versies automatisch declareren als records # Action parameter constraints rm-ac-is-kind-kinds.record_category=Recordcategorie @@ -204,8 +189,4 @@ rm-ac-is-kind-kinds.record=Record rm-ac-disposition-action-relative-positions.next=Volgende rm-ac-disposition-action-relative-positions.previous=Vorige -rm-ac-disposition-action-relative-positions.any=Willekeurig - -ac-versions.none=Nooit -ac-versions.major_only=Alleen voor primaire versies -ac-versions.all=Voor alle primaire en secundaire versies \ No newline at end of file +rm-ac-disposition-action-relative-positions.any=Willekeurig \ No newline at end of file diff --git a/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/actions_pt_BR.properties b/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/actions_pt_BR.properties index 01643c1687..4f8284ac3c 100644 --- a/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/actions_pt_BR.properties +++ b/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/actions_pt_BR.properties @@ -22,7 +22,7 @@ isRecordFiled.title=Documento arquiv\u00edstico arquivado isRecordFiled.description=O documento arquiv\u00edstico est\u00e1 arquivado. # Are closed record folders -isRecordFolderClosed.title=Pasta de documento arquiv\u00edstico fechada +isRecordFolderClosed.title=Pasta de documento arquiv\u00edstico fechada. isRecordFolderClosed.description=A pasta de documento arquiv\u00edstico est\u00e1 fechada. # Are vital @@ -51,10 +51,6 @@ create-record.title=Declarar como documento arquiv\u00edstico create-record.description=Declara o documento com um documento arquiv\u00edstico. create-record.file-plan.display-label=Plano de arquivo create-record.hide-record.display-label=Ocultar documento arquiv\u00edstico -# Declare As Version Record -declare-as-version-record.title=Declarar vers\u00e3o como documento arquiv\u00edstico -declare-as-version-record.description=Declarar nova vers\u00e3o do documento como um documento arquiv\u00edstico da vers\u00e3o. -declare-as-version-record.file-plan.display-label=Plano de arquivo # Complete record declareRecord.title=Concluir documento arquiv\u00edstico declareRecord.description=Conclui um documento arquiv\u00edstico. @@ -185,17 +181,6 @@ fileReport.description=Arquivar relat\u00f3rio # Delete Hold deleteHold.title=Excluir espera deleteHold.description=Excluir espera -# Move DM record -move-dm-record.title=Mover documento arquiv\u00edstico -move-dm-record.description=Mover documento arquiv\u00edstico -# Unlink from -unlinkFrom.title=Desvincular de -unlinkFrom.description=Desvincular de - -# Recordable version config -recordable-version-config.title=Op\u00e7\u00f5es de auto declara\u00e7\u00e3o -recordable-version-config.description=Op\u00e7\u00f5es de auto declara\u00e7\u00e3o -recordable-version-config.version.display-label=Declarar automaticamente vers\u00f5es como documentos arquiv\u00edsticos # Action parameter constraints rm-ac-is-kind-kinds.record_category=Categoria de documento arquiv\u00edstico @@ -204,8 +189,4 @@ rm-ac-is-kind-kinds.record=Documento arquiv\u00edstico rm-ac-disposition-action-relative-positions.next=Pr\u00f3ximo rm-ac-disposition-action-relative-positions.previous=Anterior -rm-ac-disposition-action-relative-positions.any=Qualquer - -ac-versions.none=Nunca -ac-versions.major_only=Somente para vers\u00f5es principais -ac-versions.all=Para todas as vers\u00f5es principais e secund\u00e1rias \ No newline at end of file +rm-ac-disposition-action-relative-positions.any=Qualquer \ No newline at end of file diff --git a/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/actions_ru.properties b/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/actions_ru.properties index 34d847dc18..50b884d103 100644 --- a/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/actions_ru.properties +++ b/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/actions_ru.properties @@ -14,15 +14,15 @@ isDeclared.title=\u0417\u0430\u043f\u0438\u0441\u044c \u0437\u0430\u0432\u0435\u isDeclared.description=\u041e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u0435\u0442, \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0430 \u043b\u0438 \u0437\u0430\u043f\u0438\u0441\u044c. # Is on hold -isFrozen.title=\u0417\u0430\u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u0430\u043d\u0430 -isFrozen.description=\u041e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u0435\u0442, \u0437\u0430\u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u0430\u043d\u0430 \u043b\u0438 \u0437\u0430\u043f\u0438\u0441\u044c \u0438\u043b\u0438 \u043f\u0430\u043f\u043a\u0430 \u0437\u0430\u043f\u0438\u0441\u0435\u0439. +isFrozen.title=\u0417\u0430\u0431\u043B\u043E\u043A\u0438\u0440\u043E\u0432\u0430\u043D\u0430 +isFrozen.description=\u041e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u0435\u0442, \u0437\u0430\u0431\u043B\u043E\u043A\u0438\u0440\u043E\u0432\u0430\u043D\u0430 \u043b\u0438 \u0437\u0430\u043f\u0438\u0441\u044c \u0438\u043b\u0438 \u043f\u0430\u043f\u043a\u0430 \u0437\u0430\u043f\u0438\u0441\u0435\u0439. # Are filed isRecordFiled.title=\u0417\u0430\u043f\u0438\u0441\u044c \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0430 \u0432 \u0444\u0430\u0439\u043b isRecordFiled.description=\u041e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u0435\u0442, \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0430 \u043b\u0438 \u0437\u0430\u043f\u0438\u0441\u044c \u0432 \u0444\u0430\u0439\u043b. # Are closed record folders -isRecordFolderClosed.title=\u041f\u0430\u043f\u043a\u0430 \u0437\u0430\u043f\u0438\u0441\u0435\u0439 \u0437\u0430\u043a\u0440\u044b\u0442\u0430 +isRecordFolderClosed.title=\u041f\u0430\u043f\u043a\u0430 \u0437\u0430\u043f\u0438\u0441\u0435\u0439 \u0437\u0430\u043a\u0440\u044b\u0442\u0430. isRecordFolderClosed.description=\u041e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u0435\u0442, \u0437\u0430\u043a\u0440\u044b\u0442\u0430 \u043b\u0438 \u043f\u0430\u043f\u043a\u0430 \u0437\u0430\u043f\u0438\u0441\u0435\u0439. # Are vital @@ -51,10 +51,6 @@ create-record.title=\u041e\u0431\u044a\u044f\u0432\u0438\u0442\u044c \u043a\u043 create-record.description=\u041e\u0431\u044a\u044f\u0432\u043b\u0435\u043d\u0438\u0435 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430 \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0437\u0430\u043f\u0438\u0441\u0438. create-record.file-plan.display-label=\u0410\u0440\u0445\u0438\u0432 create-record.hide-record.display-label=\u0421\u043a\u0440\u044b\u0442\u044c \u0437\u0430\u043f\u0438\u0441\u044c -# Declare As Version Record -declare-as-version-record.title=\u041e\u0431\u044a\u044f\u0432\u0438\u0442\u044c \u0432\u0435\u0440\u0441\u0438\u044e \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0437\u0430\u043f\u0438\u0441\u0438 -declare-as-version-record.description=\u041e\u0431\u044a\u044f\u0432\u043b\u0435\u043d\u0438\u0435 \u043d\u043e\u0432\u043e\u0439 \u0432\u0435\u0440\u0441\u0438\u0438 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430 \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0437\u0430\u043f\u0438\u0441\u0438 \u0432\u0435\u0440\u0441\u0438\u0438. -declare-as-version-record.file-plan.display-label=\u0410\u0440\u0445\u0438\u0432 # Complete record declareRecord.title=\u0417\u0430\u0432\u0435\u0440\u0448\u0438\u0442\u044c \u0437\u0430\u043f\u0438\u0441\u044c declareRecord.description=\u0417\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u0435 \u0437\u0430\u043f\u0438\u0441\u0438. @@ -117,16 +113,16 @@ setPropertyValue.title=\u0417\u0430\u0434\u0430\u0442\u044c \u0437\u043d\u0430\u setPropertyValue.description=\u0417\u0430\u0434\u0430\u043d\u0438\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430 # Edit Hold Reason -editHoldReason.title=\u0420\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043f\u0440\u0438\u0447\u0438\u043d\u044b \u0443\u0434\u0435\u0440\u0436\u0430\u043d\u0438\u044f +editHoldReason.title=\u0420\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043f\u0440\u0438\u0447\u0438\u043d\u0443 \u0443\u0434\u0435\u0440\u0436\u0430\u043d\u0438\u044f editHoldReason.description=\u0420\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043f\u0440\u0438\u0447\u0438\u043d\u044b \u0443\u0434\u0435\u0440\u0436\u0430\u043d\u0438\u044f # Relinquish Hold -relinquishHold.title=\u041e\u0441\u0432\u043e\u0431\u043e\u0436\u0434\u0435\u043d\u0438\u0435 \u0443\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u043c\u043e\u0433\u043e \u043e\u0431\u044a\u0435\u043a\u0442\u0430 +relinquishHold.title=\u041e\u0441\u0432\u043e\u0431\u043e\u0434\u0438\u0442\u044c \u0443\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u043c\u044b\u0439 \u043e\u0431\u044a\u0435\u043a\u0442 relinquishHold.description=\u041e\u0441\u0432\u043e\u0431\u043e\u0436\u0434\u0435\u043d\u0438\u0435 \u0443\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u043c\u043e\u0433\u043e \u043e\u0431\u044a\u0435\u043a\u0442\u0430 # Edit Review As Of Date -editReviewAsOfDate.title=\u0420\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u043d\u0430 \u0434\u0430\u0442\u0443 +editReviewAsOfDate.title=\u0420\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0443 \u043d\u0430 \u0434\u0430\u0442\u0443 editReviewAsOfDate.description=\u0420\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u043d\u0430 \u0434\u0430\u0442\u0443 # Edit Disposition Action As Of Date -editDispositionActionAsOfDate.title=\u0420\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u043f\u043e \u0440\u0430\u0437\u043c\u0435\u0449\u0435\u043d\u0438\u044e \u043d\u0430 \u0434\u0430\u0442\u0443 +editDispositionActionAsOfDate.title=\u0420\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u043f\u043e \u0440\u0430\u0437\u043c\u0435\u0449\u0435\u043d\u0438\u044e \u043d\u0430 \u0434\u0430\u0442\u0443 editDispositionActionAsOfDate.description=\u0420\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u043f\u043e \u0440\u0430\u0437\u043c\u0435\u0449\u0435\u043d\u0438\u044e \u043d\u0430 \u0434\u0430\u0442\u0443 # Broadcast Vital Record Definition broadcastVitalRecordDefinition.title=\u0428\u0438\u0440\u043e\u043a\u043e\u0432\u0435\u0449\u0430\u0442\u0435\u043b\u044c\u043d\u0430\u044f \u0440\u0430\u0441\u0441\u044b\u043b\u043a\u0430 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u043a\u043b\u044e\u0447\u0435\u0432\u043e\u0439 \u0437\u0430\u043f\u0438\u0441\u0438 @@ -153,8 +149,8 @@ createDispositionSchedule.description=\u0421\u043e\u0437\u0434\u0430\u0442\u044c fileDestructionReport.title=\u041e\u0442\u0447\u0435\u0442 \u043e\u0431 \u0443\u043d\u0438\u0447\u0442\u043e\u0436\u0435\u043d\u0438\u0438 \u0444\u0430\u0439\u043b\u0430 fileDestructionReport.description=\u041e\u0442\u0447\u0435\u0442 \u043e\u0431 \u0443\u043d\u0438\u0447\u0442\u043e\u0436\u0435\u043d\u0438\u0438 \u0444\u0430\u0439\u043b\u0430 # Cut off -cutoff.title=\u041e\u0442\u043a\u043b\u044e\u0447\u0438\u0442\u044c -cutoff.description=\u041e\u0442\u043a\u043b\u044e\u0447\u0438\u0442\u044c +cutoff.title=\u041e\u0442\u0440\u0435\u0437\u0430\u0442\u044c +cutoff.description=\u041e\u0442\u0440\u0435\u0437\u0430\u0442\u044c # Destroy destroy.title=\u0423\u043d\u0438\u0447\u0442\u043e\u0436\u0438\u0442\u044c destroy.description=\u0423\u043d\u0438\u0447\u0442\u043e\u0436\u0438\u0442\u044c @@ -183,19 +179,8 @@ addRecordTypes.description=\u0414\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u043 fileReport.title=\u0421\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c \u043e\u0442\u0447\u0435\u0442 \u0432 \u0444\u0430\u0439\u043b fileReport.description=\u0421\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c \u043e\u0442\u0447\u0435\u0442 \u0432 \u0444\u0430\u0439\u043b # Delete Hold -deleteHold.title=\u0423\u0434\u0430\u043b\u0438\u0442\u044c \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u0443 -deleteHold.description=\u0423\u0434\u0430\u043b\u0438\u0442\u044c \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u0443 -# Move DM record -move-dm-record.title=\u041f\u0435\u0440\u0435\u043c\u0435\u0441\u0442\u0438\u0442\u044c \u0437\u0430\u043f\u0438\u0441\u044c -move-dm-record.description=\u041f\u0435\u0440\u0435\u043c\u0435\u0441\u0442\u0438\u0442\u044c \u0437\u0430\u043f\u0438\u0441\u044c -# Unlink from -unlinkFrom.title=\u041e\u0442\u0441\u043e\u0435\u0434\u0438\u043d\u0438\u0442\u044c \u043e\u0442 -unlinkFrom.description=\u041e\u0442\u0441\u043e\u0435\u0434\u0438\u043d\u0438\u0442\u044c \u043e\u0442 - -# Recordable version config -recordable-version-config.title=\u041f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u043e\u0431\u044a\u044f\u0432\u043b\u0435\u043d\u0438\u044f -recordable-version-config.description=\u041f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u043e\u0431\u044a\u044f\u0432\u043b\u0435\u043d\u0438\u044f -recordable-version-config.version.display-label=\u0410\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043e\u0431\u044a\u044f\u0432\u043b\u044f\u0442\u044c \u0432\u0435\u0440\u0441\u0438\u0438 \u043a\u0430\u043a \u0437\u0430\u043f\u0438\u0441\u0438 +deleteHold.title=\u0423\u0434\u0430\u043b\u0438\u0442\u044c \u0431\u043B\u043E\u043A\u0438\u0440\u043E\u0432\u043A\u0443 +deleteHold.description=\u0423\u0434\u0430\u043b\u0438\u0442\u044c \u0431\u043B\u043E\u043A\u0438\u0440\u043E\u0432\u043A\u0443 # Action parameter constraints rm-ac-is-kind-kinds.record_category=\u041a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u044f \u0437\u0430\u043f\u0438\u0441\u0435\u0439 @@ -204,8 +189,4 @@ rm-ac-is-kind-kinds.record=\u0417\u0430\u043f\u0438\u0441\u044c rm-ac-disposition-action-relative-positions.next=\u0414\u0430\u043b\u0435\u0435 rm-ac-disposition-action-relative-positions.previous=\u041d\u0430\u0437\u0430\u0434 -rm-ac-disposition-action-relative-positions.any=\u041b\u044e\u0431\u043e\u0439 - -ac-versions.none=\u041d\u0438\u043a\u043e\u0433\u0434\u0430 -ac-versions.major_only=\u0422\u043e\u043b\u044c\u043a\u043e \u0434\u043b\u044f \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0445 \u0432\u0435\u0440\u0441\u0438\u0439 -ac-versions.all=\u0414\u043b\u044f \u0432\u0441\u0435\u0445 \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0445 \u0438 \u0432\u0441\u043f\u043e\u043c\u043e\u0433\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u0432\u0435\u0440\u0441\u0438\u0439 \ No newline at end of file +rm-ac-disposition-action-relative-positions.any=\u041b\u044e\u0431\u043e\u0439 \ No newline at end of file diff --git a/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/actions_zh_CN.properties b/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/actions_zh_CN.properties index 577dabe9c4..4e64652886 100644 --- a/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/actions_zh_CN.properties +++ b/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/actions_zh_CN.properties @@ -22,7 +22,7 @@ isRecordFiled.title=\u8bb0\u5f55\u5df2\u7acb\u5377 isRecordFiled.description=\u8bb0\u5f55\u662f\u5426\u7acb\u5377\u3002 # Are closed record folders -isRecordFolderClosed.title=\u8bb0\u5f55\u6587\u4ef6\u5939\u5df2\u5173\u95ed +isRecordFolderClosed.title=\u8bb0\u5f55\u6587\u4ef6\u5939\u5df2\u5173\u95ed\u3002 isRecordFolderClosed.description=\u8bb0\u5f55\u6587\u4ef6\u5939\u662f\u5426\u5df2\u5173\u95ed\u3002 # Are vital @@ -51,10 +51,6 @@ create-record.title=\u58f0\u660e\u4e3a\u8bb0\u5f55 create-record.description=\u5c06\u6587\u6863\u58f0\u660e\u4e3a\u8bb0\u5f55\u3002 create-record.file-plan.display-label=\u5f52\u7c7b\u65b9\u6848 create-record.hide-record.display-label=\u9690\u85cf\u8bb0\u5f55 -# Declare As Version Record -declare-as-version-record.title=\u58f0\u660e\u7248\u672c\u4e3a\u8bb0\u5f55 -declare-as-version-record.description=\u58f0\u660e\u65b0\u7248\u672c\u6587\u6863\u4e3a\u7248\u672c\u8bb0\u5f55\u3002 -declare-as-version-record.file-plan.display-label=\u5f52\u7c7b\u65b9\u6848 # Complete record declareRecord.title=\u5b8c\u6210\u8bb0\u5f55 declareRecord.description=\u5b8c\u6210\u8bb0\u5f55\u3002 @@ -185,17 +181,6 @@ fileReport.description=\u7acb\u5377\u62a5\u544a # Delete Hold deleteHold.title=\u5220\u9664\u4fdd\u5b58 deleteHold.description=\u5220\u9664\u4fdd\u5b58 -# Move DM record -move-dm-record.title=\u79fb\u52a8\u8bb0\u5f55 -move-dm-record.description=\u79fb\u52a8\u8bb0\u5f55 -# Unlink from -unlinkFrom.title=\u53d6\u6d88\u94fe\u63a5 -unlinkFrom.description=\u53d6\u6d88\u94fe\u63a5 - -# Recordable version config -recordable-version-config.title=\u81ea\u52a8\u58f0\u660e\u9009\u9879 -recordable-version-config.description=\u81ea\u52a8\u58f0\u660e\u9009\u9879 -recordable-version-config.version.display-label=\u81ea\u52a8\u58f0\u660e\u7248\u672c\u4e3a\u8bb0\u5f55 # Action parameter constraints rm-ac-is-kind-kinds.record_category=\u8bb0\u5f55\u7c7b\u522b @@ -204,8 +189,4 @@ rm-ac-is-kind-kinds.record=\u8bb0\u5f55 rm-ac-disposition-action-relative-positions.next=\u4e0b\u4e00\u6b65 rm-ac-disposition-action-relative-positions.previous=\u4e0a\u4e00\u6b65 -rm-ac-disposition-action-relative-positions.any=\u4efb\u4f55 - -ac-versions.none=\u4ece\u4e0d -ac-versions.major_only=\u4ec5\u9002\u7528\u4e8e\u4e3b\u8981\u7248\u672c -ac-versions.all=\u9002\u7528\u4e8e\u6240\u6709\u4e3b\u8981\u548c\u6b21\u8981\u7248\u672c \ No newline at end of file +rm-ac-disposition-action-relative-positions.any=\u4efb\u4f55 \ No newline at end of file diff --git a/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/admin-service.properties b/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/admin-service.properties index 2e837c01a4..d4fc6badd4 100644 --- a/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/admin-service.properties +++ b/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/admin-service.properties @@ -6,6 +6,11 @@ rm.admin.cannot-apply-constraint=Cannot apply constraint {0} to property {1} wit rm.admin.prop-exist=The custom property {0} can't be found. rm.admin.custom-prop-exist=The custom model does not contain the property {0}. rm.admin.unknown-aspect=Unknown aspect {0}. +rm.admin.ref-exist=The custom reference {0} can't be found. +rm.admin.ref-label-in-use=The reference label {0} is already in use. +rm.admin.assoc-exists=The association {0} already exists. +rm.admin.child-assoc-exists=the child association {0} already exists. +rm.admin.cannot-find-assoc-def=The association definition {0} can't be found. rm.admin.constraint-exists=The constraint {0} already exists. rm.admin.contraint-cannot-find=The definition for constraint {0} can't be found. rm.admin.unexpected_type_constraint=Unexpected type {0} for constraint {1}. The expected is {2}. diff --git a/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/admin-service_de.properties b/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/admin-service_de.properties index 4e94f1a10c..3716974166 100644 --- a/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/admin-service_de.properties +++ b/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/admin-service_de.properties @@ -6,6 +6,11 @@ rm.admin.cannot-apply-constraint=Randbedingung {0} kann nicht auf Eigenschaft {1 rm.admin.prop-exist=Benutzerdefinierte Eigenschaft {0} wurde nicht gefunden. rm.admin.custom-prop-exist=Das benutzerdefinierte Modell enth\u00e4lt nicht die Eigenschaft {0}. rm.admin.unknown-aspect=Unbekannter Aspekt {0}. +rm.admin.ref-exist=Benutzerdefinierte Referenz {0} wurde nicht gefunden. +rm.admin.ref-label-in-use=Referenzbezeichnung {0} wird bereits verwendet. +rm.admin.assoc-exists=Zuordnung {0} bereits vorhanden. +rm.admin.child-assoc-exists=Kindzuordnung {0} bereits vorhanden. +rm.admin.cannot-find-assoc-def=Zuordnungsdefinition {0} wurde nicht gefunden. rm.admin.constraint-exists=Randbedingung {0} bereits vorhanden. rm.admin.contraint-cannot-find=Die Definition f\u00fcr Randbedingung {0} wurde nicht gefunden. rm.admin.unexpected_type_constraint=Unerwarteter Typ {0} f\u00fcr Randbedingung {1}. Erwartet wird {2}. diff --git a/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/admin-service_es.properties b/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/admin-service_es.properties index f8fa25e9f9..7f63a1946a 100644 --- a/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/admin-service_es.properties +++ b/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/admin-service_es.properties @@ -6,11 +6,16 @@ rm.admin.cannot-apply-constraint=No se puede aplicar la restricci\u00f3n ''{0}'' rm.admin.prop-exist=No se puede encontrar la propiedad personalizada ''{0}''. rm.admin.custom-prop-exist=El modelo personalizado no contiene la propiedad ''{0}''. rm.admin.unknown-aspect=Aspecto desconocido ''{0}''. +rm.admin.ref-exist=No se puede encontrar la referencia personalizada ''{0}''. +rm.admin.ref-label-in-use=La etiqueta de referencia ''{0}'' ya est\u00e1 en uso. +rm.admin.assoc-exists=La asociaci\u00f3n ''{0}'' ya existe. +rm.admin.child-assoc-exists=La asociaci\u00f3n secundaria ''{0}'' ya existe. +rm.admin.cannot-find-assoc-def=No se puede encontrar la definici\u00f3n de asociaci\u00f3n ''{0}''. rm.admin.constraint-exists=La restricci\u00f3n ''{0}'' ya existe. rm.admin.contraint-cannot-find=No se puede encontrar la definici\u00f3n para la restricci\u00f3n ''{0}''. -rm.admin.unexpected_type_constraint=Tipo ineseperado ''{0}'' para la restricci\u00f3n ''{1}''. The expected is ''{2}''. +rm.admin.unexpected_type_constraint=Tipo inesperado ''{0}'' para la restricci\u00f3n ''{1}''. Lo esperado es ''{2}''. rm.admin.custom-model-not-found=No se puede encontrar el modelo personalizado ''{0}''. -rm.admin.custom-model-no-content=El modelo personalizado no t (nodeRef={0}) +rm.admin.custom-model-no-content=El modelo personalizado no tiene contenido (nodeRef={0}) rm.admin.error-write-custom-model=Error al escribir contenido de modelo personalizado. (nodeRef={0}) rm.admin.error-client-id=Error al generar el identificador del cliente porque ya est\u00e1 en uso. (clientid={0}) rm.admin.error-split-id=No se puede separar el identificador ''{0}'', porque el separador ''{1}'' no est\u00e1 presente. \ No newline at end of file diff --git a/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/admin-service_fr.properties b/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/admin-service_fr.properties index 6c11c13c2d..0e2cb4ea77 100644 --- a/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/admin-service_fr.properties +++ b/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/admin-service_fr.properties @@ -6,6 +6,11 @@ rm.admin.cannot-apply-constraint=Impossible d''appliquer la contrainte {0} \u00e rm.admin.prop-exist=La m\u00e9tadonn\u00e9e personnalis\u00e9e {0} est introuvable. rm.admin.custom-prop-exist=Le mod\u00e8le personnalis\u00e9 ne contient pas la propri\u00e9t\u00e9 {0}. rm.admin.unknown-aspect=Aspect {0} inconnu. +rm.admin.ref-exist=La r\u00e9f\u00e9rence personnalis\u00e9e {0} est introuvable. +rm.admin.ref-label-in-use=Le libell\u00e9 {0} de la r\u00e9f\u00e9rence est d\u00e9j\u00e0 en cours d''utilisation. +rm.admin.assoc-exists=L''association {0} existe d\u00e9j\u00e0. +rm.admin.child-assoc-exists=L''association enfant {0} existe d\u00e9j\u00e0. +rm.admin.cannot-find-assoc-def=La d\u00e9finition d''association {0} est introuvable. rm.admin.constraint-exists=La contrainte {0} existe d\u00e9j\u00e0. rm.admin.contraint-cannot-find=La d\u00e9finition de la contrainte {0} est introuvable. rm.admin.unexpected_type_constraint=Type {0} inattendu pour la contrainte {1}. Attendu\u00a0: {2} diff --git a/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/admin-service_it.properties b/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/admin-service_it.properties index a590c881e5..98211e29d5 100644 --- a/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/admin-service_it.properties +++ b/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/admin-service_it.properties @@ -6,6 +6,11 @@ rm.admin.cannot-apply-constraint=Impossibile applicare il vincolo {0} alla propr rm.admin.prop-exist=Impossibile trovare la propriet\u00e0 personalizzata {0}. rm.admin.custom-prop-exist=Il modello personalizzato non contiene la propriet\u00e0 {0}. rm.admin.unknown-aspect=Aspetto {0} sconosciuto. +rm.admin.ref-exist=Impossibile trovare il riferimento personalizzato {0}. +rm.admin.ref-label-in-use=L''etichetta di riferimento {0} \u00e8 gi\u00e0 in uso. +rm.admin.assoc-exists=L''associazione {0} \u00e8 gi\u00e0 esistente. +rm.admin.child-assoc-exists=L''associazione secondaria {0} \u00e8 gi\u00e0 esistente. +rm.admin.cannot-find-assoc-def=Impossibile trovare la definizione di associazione {0}. rm.admin.constraint-exists=Il vincolo {0} \u00e8 gi\u00e0 esistente. rm.admin.contraint-cannot-find=Impossibile trovare la definizione di vincolo {0}. rm.admin.unexpected_type_constraint=Tipo {0} inaspettato per vincolo {1}. Ci\u00f2 che si aspetta \u00e8 {2}. diff --git a/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/admin-service_ja.properties b/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/admin-service_ja.properties index 5112339525..beb5cb6db6 100644 --- a/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/admin-service_ja.properties +++ b/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/admin-service_ja.properties @@ -6,6 +6,11 @@ rm.admin.cannot-apply-constraint=\u5236\u7d04 {0} \u3092\u30d7\u30ed\u30d1\u30c6 rm.admin.prop-exist=\u30ab\u30b9\u30bf\u30e0\u30d7\u30ed\u30d1\u30c6\u30a3 {0} \u304c\u898b\u3064\u304b\u308a\u307e\u305b\u3093\u3002 rm.admin.custom-prop-exist=\u30ab\u30b9\u30bf\u30e0\u30e2\u30c7\u30eb\u306b\u306f\u30d7\u30ed\u30d1\u30c6\u30a3 {0} \u304c\u542b\u307e\u308c\u3066\u3044\u307e\u305b\u3093\u3002 rm.admin.unknown-aspect=\u4e0d\u660e\u306a\u30a2\u30b9\u30da\u30af\u30c8 {0}\u3002 +rm.admin.ref-exist=\u30ab\u30b9\u30bf\u30e0\u53c2\u7167 {0} \u304c\u898b\u3064\u304b\u308a\u307e\u305b\u3093\u3002 +rm.admin.ref-label-in-use=\u53c2\u7167\u30e9\u30d9\u30eb {0} \u306f\u3059\u3067\u306b\u4f7f\u7528\u4e2d\u3067\u3059\u3002 +rm.admin.assoc-exists=\u95a2\u9023 {0} \u306f\u3059\u3067\u306b\u5b58\u5728\u3057\u307e\u3059\u3002 +rm.admin.child-assoc-exists=\u5b50\u95a2\u9023 {0} \u306f\u3059\u3067\u306b\u5b58\u5728\u3057\u307e\u3059\u3002 +rm.admin.cannot-find-assoc-def=\u95a2\u9023\u306e\u5b9a\u7fa9 {0} \u304c\u898b\u3064\u304b\u308a\u307e\u305b\u3093\u3002 rm.admin.constraint-exists=\u5236\u7d04 {0} \u306f\u3059\u3067\u306b\u5b58\u5728\u3057\u307e\u3059\u3002 rm.admin.contraint-cannot-find=\u5236\u7d04\u306e\u5b9a\u7fa9 {0} \u304c\u898b\u3064\u304b\u308a\u307e\u305b\u3093\u3002 rm.admin.unexpected_type_constraint=\u5236\u7d04 {1} \u306b\u5bfe\u3057\u3066\u4e88\u671f\u305b\u306c\u30bf\u30a4\u30d7 {0} \u3067\u3059\u3002{2} \u306f\u4e88\u671f\u3055\u308c\u308b\u30bf\u30a4\u30d7\u3067\u3059\u3002 diff --git a/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/admin-service_nb.properties b/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/admin-service_nb.properties deleted file mode 100644 index a3eeb23dff..0000000000 --- a/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/admin-service_nb.properties +++ /dev/null @@ -1,16 +0,0 @@ -rm.admin.service-not-init=Tilpasningstjenesten er ikke staret. -rm.admin.not-customisable=Klassen {0} kan ikke tilpasses. -rm.admin.invalid-custom-aspect=Fant ikke tilpasningsapektet {0} til klassen {1} som kan tilpasses. -rm.admin.property-already-exists=Egenskapen {0} finnes allerede. -rm.admin.cannot-apply-constraint=Kan ikke p\u00e5f\u00f8re restriksjonen {0} p\u00e5 egenskapen {1} med datatype {2}. (forventet datatype = TEKST) -rm.admin.prop-exist=Fant ikke tilpasset egenskap {0}. -rm.admin.custom-prop-exist=Den tilpassede modellen kan ikke inneholde egenskapen {0}. -rm.admin.unknown-aspect=Ukjent aspekt {0}. -rm.admin.constraint-exists=Restriksjonen {0} finnes allerede. -rm.admin.contraint-cannot-find=Finner ikke definisjonen til restriksjonen {0}. -rm.admin.unexpected_type_constraint=Uventet type {0} ved restriksjonen {1}. {2} var forventet... -rm.admin.custom-model-not-found=Fant ikke den tilpassede modellen {0}. -rm.admin.custom-model-no-content=Den tilpassede modellen har ikke innhold. (nodeRef={0}) -rm.admin.error-write-custom-model=Feil ved utskrift av innholdet til den tilpassende modellen. (nodeRef={0}). -rm.admin.error-client-id=Feil ved generering av klient-ID fordi den allerede er i bruk. (clientid={0}) -rm.admin.error-split-id=Kan ikke dele ID {0} fordi skilletegnet {1} mangler. \ No newline at end of file diff --git a/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/admin-service_nl.properties b/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/admin-service_nl.properties index f8bad865ee..3f7e67ce06 100755 --- a/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/admin-service_nl.properties +++ b/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/admin-service_nl.properties @@ -6,6 +6,11 @@ rm.admin.cannot-apply-constraint=Kan beperking {0} niet toepassen op eigenschap rm.admin.prop-exist=De aangepaste eigenschap {0} kan niet worden gevonden. rm.admin.custom-prop-exist=Het aangepaste model bevat de eigenschap {0} niet. rm.admin.unknown-aspect=Onbekend aspect {0}. +rm.admin.ref-exist=De aangepaste referentie {0} kan niet worden gevonden. +rm.admin.ref-label-in-use=Het verwijzingslabel {0} is al in gebruik. +rm.admin.assoc-exists=De koppeling {0} bestaat al. +rm.admin.child-assoc-exists=De onderliggende koppeling {0} bestaat al. +rm.admin.cannot-find-assoc-def=De koppelingsdefinitie {0} kan niet worden gevonden. rm.admin.constraint-exists=De beperking {0} bestaat al. rm.admin.contraint-cannot-find=De definitie voor beperking {0} kan niet worden gevonden. rm.admin.unexpected_type_constraint=Onverwacht type {0} voor beperking {1}. Het verwachte type is {2}. diff --git a/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/admin-service_pt_BR.properties b/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/admin-service_pt_BR.properties index 57de19b6ba..90465c5e10 100644 --- a/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/admin-service_pt_BR.properties +++ b/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/admin-service_pt_BR.properties @@ -6,6 +6,11 @@ rm.admin.cannot-apply-constraint=N\u00e3o \u00e9 poss\u00edvel aplicar a reserva rm.admin.prop-exist=N\u00e3o foi poss\u00edvel localizar a propriedade personalizada {0}. rm.admin.custom-prop-exist=O modelo personalizado n\u00e3o cont\u00e9m a propriedade {0}. rm.admin.unknown-aspect=Aspecto desconhecido {0}. +rm.admin.ref-exist=N\u00e3o foi poss\u00edvel localizar a refer\u00eancia personalizada {0}. +rm.admin.ref-label-in-use=O r\u00f3tulo de refer\u00eancia {0} j\u00e1 est\u00e1 em uso. +rm.admin.assoc-exists=A associa\u00e7\u00e3o {0} j\u00e1 existe. +rm.admin.child-assoc-exists=A associa\u00e7\u00e3o secund\u00e1ria {0} j\u00e1 existe. +rm.admin.cannot-find-assoc-def=N\u00e3o \u00e9 poss\u00edvel localizar a defini\u00e7\u00e3o da associa\u00e7\u00e3o {0}. rm.admin.constraint-exists=A reserva {0} j\u00e1 existe. rm.admin.contraint-cannot-find=N\u00e3o \u00e9 poss\u00edvel localizar a defini\u00e7\u00e3o da reserva {0}. rm.admin.unexpected_type_constraint=Tipo inesperado {0} para a reserva {1}. O tipo esperado \u00e9 {2}. diff --git a/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/admin-service_ru.properties b/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/admin-service_ru.properties index 97ae7d813d..1b62888025 100644 --- a/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/admin-service_ru.properties +++ b/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/admin-service_ru.properties @@ -6,6 +6,11 @@ rm.admin.cannot-apply-constraint=\u041d\u0435\u0432\u043e\u0437\u043c\u043e\u043 rm.admin.prop-exist=\u041d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0439\u0442\u0438 \u043d\u0435\u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u0435 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u043e {0}. rm.admin.custom-prop-exist=\u0421\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u0430\u044f \u043c\u043e\u0434\u0435\u043b\u044c \u043d\u0435 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u043e {0}. rm.admin.unknown-aspect=\u041d\u0435\u0438\u0437\u0432\u0435\u0441\u0442\u043d\u044b\u0439 \u0430\u0441\u043f\u0435\u043a\u0442 {0}. +rm.admin.ref-exist=\u041d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0439\u0442\u0438 \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u0443\u044e \u0441\u0441\u044b\u043b\u043a\u0443 {0}. +rm.admin.ref-label-in-use=\u041d\u0430\u0434\u043f\u0438\u0441\u044c \u0441\u043e \u0441\u0441\u044b\u043b\u043a\u043e\u0439 {0} \u0443\u0436\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f. +rm.admin.assoc-exists=\u0410\u0441\u0441\u043e\u0446\u0438\u0430\u0446\u0438\u044f {0} \u0443\u0436\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442. +rm.admin.child-assoc-exists=\u0414\u043e\u0447\u0435\u0440\u043d\u044f\u044f \u0430\u0441\u0441\u043e\u0446\u0438\u0430\u0446\u0438\u044f {0} \u0443\u0436\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442. +rm.admin.cannot-find-assoc-def=\u041d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0439\u0442\u0438 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0430\u0441\u0441\u043e\u0446\u0438\u0430\u0446\u0438\u0438 {0}. rm.admin.constraint-exists=\u041e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u0435 {0} \u0443\u0436\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442. rm.admin.contraint-cannot-find=\u041d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0439\u0442\u0438 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u044f {0}. rm.admin.unexpected_type_constraint=\u041d\u0435\u043f\u0440\u0435\u0434\u0432\u0438\u0434\u0435\u043d\u043d\u044b\u0439 \u0442\u0438\u043f {0} \u0434\u043b\u044f \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u044f {1}. \u041e\u0436\u0438\u0434\u0430\u0435\u0442\u0441\u044f: {2}. diff --git a/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/admin-service_zh_CN.properties b/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/admin-service_zh_CN.properties index e3262abbb7..43ec4bb887 100644 --- a/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/admin-service_zh_CN.properties +++ b/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/admin-service_zh_CN.properties @@ -6,6 +6,11 @@ rm.admin.cannot-apply-constraint=\u65e0\u6cd5\u5c06\u7ea6\u675f {0} \u5e94\u7528 rm.admin.prop-exist=\u65e0\u6cd5\u627e\u5230\u81ea\u5b9a\u4e49\u5c5e\u6027 {0}\u3002 rm.admin.custom-prop-exist=\u81ea\u5b9a\u4e49\u6a21\u578b\u4e0d\u5305\u542b\u5c5e\u6027 {0}\u3002 rm.admin.unknown-aspect=\u672a\u77e5\u5207\u9762 {0}\u3002 +rm.admin.ref-exist=\u65e0\u6cd5\u627e\u5230\u81ea\u5b9a\u4e49\u53c2\u8003 {0}\u3002 +rm.admin.ref-label-in-use=\u53c2\u8003\u6807\u7b7e {0} \u5df2\u5728\u4f7f\u7528\u4e2d\u3002 +rm.admin.assoc-exists=\u5173\u8054 {0} \u5df2\u5b58\u5728\u3002 +rm.admin.child-assoc-exists=\u5b50\u5173\u8054 {0} \u5df2\u5b58\u5728\u3002 +rm.admin.cannot-find-assoc-def=\u65e0\u6cd5\u627e\u5230\u5173\u8054\u5b9a\u4e49 {0}\u3002 rm.admin.constraint-exists=\u7ea6\u675f {0} \u5df2\u5b58\u5728\u3002 rm.admin.contraint-cannot-find=\u65e0\u6cd5\u627e\u5230\u7ea6\u675f {0} \u7684\u5b9a\u4e49\u3002 rm.admin.unexpected_type_constraint=\u7ea6\u675f {1} \u7684\u610f\u5916\u7c7b\u578b {0}\u3002\u9884\u671f\u4e3a {2}\u3002 diff --git a/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/audit-service.properties b/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/audit-service.properties index 7604e39f3b..62c4177481 100644 --- a/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/audit-service.properties +++ b/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/audit-service.properties @@ -13,5 +13,4 @@ rm.audit.audit-stop=Audit Stop rm.audit.audit-clear=Audit Clear rm.audit.audit-view=Audit View rm.audit.trail-file-fail=Can't generate audit report. -rm.audit.audit-report=Audit Report -recordable-version-config=Auto-Declare Options \ No newline at end of file +rm.audit.audit-report=Audit Report \ No newline at end of file diff --git a/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/audit-service_de.properties b/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/audit-service_de.properties index 16bbceb073..5864c414fe 100644 --- a/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/audit-service_de.properties +++ b/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/audit-service_de.properties @@ -13,5 +13,4 @@ rm.audit.audit-stop=Audit stoppen rm.audit.audit-clear=Audit l\u00f6schen rm.audit.audit-view=Audit anzeigen rm.audit.trail-file-fail=Audit-Bericht kann nicht erstellt werden. -rm.audit.audit-report=Audit-Bericht -recordable-version-config=Optionen f\u00fcr automatische Deklaration \ No newline at end of file +rm.audit.audit-report=Audit-Bericht \ No newline at end of file diff --git a/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/audit-service_es.properties b/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/audit-service_es.properties index 7a2961f53f..618587add2 100644 --- a/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/audit-service_es.properties +++ b/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/audit-service_es.properties @@ -13,5 +13,4 @@ rm.audit.audit-stop=Detener auditor\u00eda rm.audit.audit-clear=Limpiar auditor\u00eda rm.audit.audit-view=Ver auditor\u00eda rm.audit.trail-file-fail=No se puede generar el informe de auditor\u00eda. -rm.audit.audit-report=Informe de auditor\u00eda -recordable-version-config=Opciones de declaraci\u00f3n autom\u00e1tica \ No newline at end of file +rm.audit.audit-report=Informe de auditor\u00eda \ No newline at end of file diff --git a/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/audit-service_fr.properties b/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/audit-service_fr.properties index 0b773ba071..0276e1e3c5 100644 --- a/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/audit-service_fr.properties +++ b/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/audit-service_fr.properties @@ -13,5 +13,4 @@ rm.audit.audit-stop=Audit arr\u00eat\u00e9 rm.audit.audit-clear=Audit supprim\u00e9 rm.audit.audit-view=Audit affich\u00e9 rm.audit.trail-file-fail=Impossible de g\u00e9n\u00e9rer un rapport d'audit. -rm.audit.audit-report=Rapport d'audit -recordable-version-config=Options de d\u00e9claration automatique \ No newline at end of file +rm.audit.audit-report=Rapport d'audit \ No newline at end of file diff --git a/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/audit-service_it.properties b/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/audit-service_it.properties index 217ec94e36..0ca34b819e 100644 --- a/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/audit-service_it.properties +++ b/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/audit-service_it.properties @@ -13,5 +13,4 @@ rm.audit.audit-stop=Interruzione audit rm.audit.audit-clear=Cancellazione audit rm.audit.audit-view=Visualizzazione audit rm.audit.trail-file-fail=Impossibile generare il report dell'audit -rm.audit.audit-report=Report audit -recordable-version-config=Opzioni di dichiarazione automatica \ No newline at end of file +rm.audit.audit-report=Report audit \ No newline at end of file diff --git a/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/audit-service_ja.properties b/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/audit-service_ja.properties index c4a591879a..4272f4592b 100644 --- a/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/audit-service_ja.properties +++ b/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/audit-service_ja.properties @@ -13,5 +13,4 @@ rm.audit.audit-stop=\u76e3\u67fb\u505c\u6b62 rm.audit.audit-clear=\u76e3\u67fb\u6d88\u53bb rm.audit.audit-view=\u76e3\u67fb\u8868\u793a rm.audit.trail-file-fail=\u76e3\u67fb\u30ec\u30dd\u30fc\u30c8\u3092\u4f5c\u6210\u3067\u304d\u307e\u305b\u3093\u3002 -rm.audit.audit-report=\u76e3\u67fb\u30ec\u30dd\u30fc\u30c8 -recordable-version-config=\u81ea\u52d5\u5ba3\u8a00\u30aa\u30d7\u30b7\u30e7\u30f3 \ No newline at end of file +rm.audit.audit-report=\u76e3\u67fb\u30ec\u30dd\u30fc\u30c8 \ No newline at end of file diff --git a/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/audit-service_nb.properties b/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/audit-service_nb.properties deleted file mode 100644 index 60e6cb4c3e..0000000000 --- a/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/audit-service_nb.properties +++ /dev/null @@ -1,17 +0,0 @@ -rm.audit.updated-metadata=Oppdatert metadata -rm.audit.created-object=Opprettet element -rm.audit.delete-object=Slett element -rm.audit.login-succeeded=Vellykket p\u00e5logging -rm.audit.login-failed=Mislykket p\u00e5logging -rm.audit.create-person=Opprett person -rm.audit.linkTo=Koble til -rm.audit.moveTo=Flytt til -rm.audit.copyTo=Kopier til -rm.audit.fileTo=Arkiver i -rm.audit.audit-start=Revisjonsstart -rm.audit.audit-stop=Revisjonsstopp -rm.audit.audit-clear=Slett revisjon -rm.audit.audit-view=Vis revisjon -rm.audit.trail-file-fail=Kan ikke generere revisjonsrapport. -rm.audit.audit-report=Revisjonsrapport -recordable-version-config=Alternativer med automatiske erkl\u00e6ringer \ No newline at end of file diff --git a/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/audit-service_nl.properties b/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/audit-service_nl.properties index 9c746e6266..aac362db7a 100755 --- a/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/audit-service_nl.properties +++ b/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/audit-service_nl.properties @@ -13,5 +13,4 @@ rm.audit.audit-stop=Audit stoppen rm.audit.audit-clear=Audit wissen rm.audit.audit-view=Audit bekijken rm.audit.trail-file-fail=Kan geen auditrapport maken. -rm.audit.audit-report=Auditrapport -recordable-version-config=Opties voor automatisch declareren \ No newline at end of file +rm.audit.audit-report=Auditrapport \ No newline at end of file diff --git a/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/audit-service_pt_BR.properties b/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/audit-service_pt_BR.properties index 23ae93e367..f9ef070a92 100644 --- a/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/audit-service_pt_BR.properties +++ b/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/audit-service_pt_BR.properties @@ -13,5 +13,4 @@ rm.audit.audit-stop=Parada da auditoria rm.audit.audit-clear=Limpeza de auditoria rm.audit.audit-view=Exibi\u00e7\u00e3o de auditoria rm.audit.trail-file-fail=N\u00e3o \u00e9 poss\u00edvel gerar relat\u00f3rio de auditoria. -rm.audit.audit-report=Relat\u00f3rio de auditoria -recordable-version-config=Op\u00e7\u00f5es de auto declara\u00e7\u00e3o \ No newline at end of file +rm.audit.audit-report=Relat\u00f3rio de auditoria \ No newline at end of file diff --git a/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/audit-service_ru.properties b/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/audit-service_ru.properties index 301f354eeb..0d4bc7f649 100644 --- a/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/audit-service_ru.properties +++ b/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/audit-service_ru.properties @@ -13,5 +13,4 @@ rm.audit.audit-stop=\u041e\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 \u043 rm.audit.audit-clear=\u041e\u0447\u0438\u0441\u0442\u043a\u0430 \u0430\u0443\u0434\u0438\u0442\u0430 rm.audit.audit-view=\u041f\u0440\u043e\u0441\u043c\u043e\u0442\u0440 \u0430\u0443\u0434\u0438\u0442\u0430 rm.audit.trail-file-fail=\u041d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u043e\u0442\u0447\u0435\u0442 \u043e\u0431 \u0430\u0443\u0434\u0438\u0442\u0435. -rm.audit.audit-report=\u041e\u0442\u0447\u0435\u0442 \u043e\u0431 \u0430\u0443\u0434\u0438\u0442\u0435 -recordable-version-config=\u041f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u043e\u0431\u044a\u044f\u0432\u043b\u0435\u043d\u0438\u044f \ No newline at end of file +rm.audit.audit-report=\u041e\u0442\u0447\u0435\u0442 \u043e\u0431 \u0430\u0443\u0434\u0438\u0442\u0435 \ No newline at end of file diff --git a/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/audit-service_zh_CN.properties b/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/audit-service_zh_CN.properties index 871f195dcf..7c38f38a35 100644 --- a/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/audit-service_zh_CN.properties +++ b/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/audit-service_zh_CN.properties @@ -13,5 +13,4 @@ rm.audit.audit-stop=\u505c\u6b62\u5ba1\u8ba1 rm.audit.audit-clear=\u6e05\u9664\u5ba1\u8ba1 rm.audit.audit-view=\u67e5\u770b\u5ba1\u8ba1 rm.audit.trail-file-fail=\u65e0\u6cd5\u751f\u6210\u5ba1\u8ba1\u62a5\u544a\u3002 -rm.audit.audit-report=\u5ba1\u8ba1\u62a5\u544a -recordable-version-config=\u81ea\u52a8\u58f0\u660e\u9009\u9879 \ No newline at end of file +rm.audit.audit-report=\u5ba1\u8ba1\u62a5\u544a \ No newline at end of file diff --git a/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/capability-service.properties b/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/capability-service.properties index 6ad06364f6..a68671673c 100644 --- a/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/capability-service.properties +++ b/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/capability-service.properties @@ -8,7 +8,6 @@ capability.RequestRecordInformation.title=Request Record Information capability.RejectRecords.title=Reject Records capability.FileUnfiledRecords.title=File Unfiled Records capability.LinkToRecords.title=Link Records -capability.DeleteLinks.title=Unlink Records # Metadata Control capability.group.metadataControl.title=Metadata Control @@ -33,6 +32,7 @@ capability.PlanningReviewCycles.title=Planning Review Cycles # References and Links capability.group.references.title=References capability.ChangeOrDeleteReferences.title=Change or Delete References +capability.DeleteLinks.title=Delete Links # Events capability.group.events.title=Events @@ -56,7 +56,6 @@ capability.DeleteRecords.title=Delete Records capability.TriggerAnEvent.title=Trigger An Event capability.FileDestructionReport.title=File Destruction Report capability.FileTransferReport.title=File Transfer Report -capability.EndRetention.title=End Retention # Hold Controls capability.group.holdControls.title=Hold Controls diff --git a/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/capability-service_de.properties b/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/capability-service_de.properties index 10ba7fe0a7..6c08118a21 100644 --- a/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/capability-service_de.properties +++ b/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/capability-service_de.properties @@ -8,7 +8,6 @@ capability.RequestRecordInformation.title=Record-Informationen anfordern capability.RejectRecords.title=Records ablehnen capability.FileUnfiledRecords.title=Nicht abgelegte Records ablegen capability.LinkToRecords.title=Records verkn\u00fcpfen -capability.DeleteLinks.title=Verkn\u00fcpfung zu Records aufheben # Metadata Control capability.group.metadataControl.title=Metadaten-Steuerung @@ -33,6 +32,7 @@ capability.PlanningReviewCycles.title=\u00dcberpr\u00fcfungszyklen planen # References and Links capability.group.references.title=Referenzen capability.ChangeOrDeleteReferences.title=Referenzen \u00e4ndern oder l\u00f6schen +capability.DeleteLinks.title=Links l\u00f6schen # Events capability.group.events.title=Ereignisse @@ -56,7 +56,6 @@ capability.DeleteRecords.title=Records l\u00f6schen capability.TriggerAnEvent.title=Ereignis ausl\u00f6sen capability.FileDestructionReport.title=Vernichtungsprotokoll ablegen capability.FileTransferReport.title=\u00dcbertragungsbericht ablegen -capability.EndRetention.title=Aufbewahrung beenden # Hold Controls capability.group.holdControls.title=Sperrsteuerung @@ -85,8 +84,8 @@ capability.CreateModifyDestroyRoles.title=Rollen erstellen/\u00e4ndern/vernichte capability.CreateModifyDestroyUsersAndGroups.title=Benutzer und Gruppen erstellen/\u00e4ndern/vernichten capability.PasswordControl.title=Passwortsteuerung capability.DisplayRightsReport.title=Rechtebericht anzeigen -capability.ManageAccessControls.title=Zuweisung von Gruppen- und Benutzerrollen -capability.ManageAccessRights.title=Berechtigungen verwalten +capability.ManageAccessControls.title=Zugriffssteuerungen verwalten +capability.ManageAccessRights.title=Zugriffsrechte verwalten # Configuration capability.group.config.title=Konfiguration diff --git a/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/capability-service_es.properties b/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/capability-service_es.properties index 697490e3fa..a9715598df 100644 --- a/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/capability-service_es.properties +++ b/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/capability-service_es.properties @@ -8,7 +8,6 @@ capability.RequestRecordInformation.title=Solicitar informaci\u00f3n sobre docum capability.RejectRecords.title=Rechazar documentos de archivo capability.FileUnfiledRecords.title=Archivar documentos de archivo no archivados capability.LinkToRecords.title=Enlazar documentos de archivo -capability.DeleteLinks.title=Desvincular documentos de archivo # Metadata Control capability.group.metadataControl.title=Control de metadatos @@ -33,6 +32,7 @@ capability.PlanningReviewCycles.title=Planificaci\u00f3n de ciclos de revisi\u00 # References and Links capability.group.references.title=Referencias capability.ChangeOrDeleteReferences.title=Cambiar o eliminar referencias +capability.DeleteLinks.title=Eliminar enlaces # Events capability.group.events.title=Eventos @@ -56,7 +56,6 @@ capability.DeleteRecords.title=Eliminar documentos de archivo capability.TriggerAnEvent.title=Ejecutar un evento capability.FileDestructionReport.title=Archivar informe de destrucci\u00f3n capability.FileTransferReport.title=Archivar informe de transferencia -capability.EndRetention.title=Terminar retenci\u00f3n # Hold Controls capability.group.holdControls.title=Bloquear controles @@ -85,8 +84,8 @@ capability.CreateModifyDestroyRoles.title=Crear Modificar Destruir roles capability.CreateModifyDestroyUsersAndGroups.title=Crear Modificar Destruir usuarios y grupos capability.PasswordControl.title=Control de contrase\u00f1a capability.DisplayRightsReport.title=Informe de derechos de presentaci\u00f3n -capability.ManageAccessControls.title=Asignaci\u00f3n de rol de usuario y grupo -capability.ManageAccessRights.title=Administrar permisos +capability.ManageAccessControls.title=Gestionar controles de acceso +capability.ManageAccessRights.title=Gestionar derechos de acceso # Configuration capability.group.config.title=Configuraci\u00f3n diff --git a/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/capability-service_fr.properties b/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/capability-service_fr.properties index d910940654..3996a6b316 100644 --- a/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/capability-service_fr.properties +++ b/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/capability-service_fr.properties @@ -8,7 +8,6 @@ capability.RequestRecordInformation.title=Demander des informations sur un docum capability.RejectRecords.title=Rejeter des documents d'archives capability.FileUnfiledRecords.title=Classer des documents d'archives non class\u00e9s capability.LinkToRecords.title=Lier des documents d'archives -capability.DeleteLinks.title=Supprimer le lien des enregistrements # Metadata Control capability.group.metadataControl.title=Contr\u00f4le des m\u00e9tadonn\u00e9es @@ -33,10 +32,11 @@ capability.PlanningReviewCycles.title=Planifier les cycles de r\u00e9vision # References and Links capability.group.references.title=R\u00e9f\u00e9rences capability.ChangeOrDeleteReferences.title=Modifier ou supprimer des r\u00e9f\u00e9rences +capability.DeleteLinks.title=Supprimer des liens # Events -capability.group.events.title=Ev\u00e9nements -capability.CreateModifyDestroyEvents.title=Cr\u00e9er Modifier D\u00e9truire Ev\u00e9nements +capability.group.events.title=\u00c9v\u00e9nements +capability.CreateModifyDestroyEvents.title=Cr\u00e9er Modifier D\u00e9truire \u00c9v\u00e9nements capability.AddModifyEventDates.title=Ajouter Modifier Dates d'\u00e9v\u00e9nements # Cutoff @@ -56,7 +56,6 @@ capability.DeleteRecords.title=Supprimer des documents d'archives capability.TriggerAnEvent.title=D\u00e9clencher un \u00e9v\u00e9nement capability.FileDestructionReport.title=Rapport de destruction de fichier capability.FileTransferReport.title=Rapport de transfert de fichier -capability.EndRetention.title=Mettre fin \u00e0 la r\u00e9tention # Hold Controls capability.group.holdControls.title=Suspendre les contr\u00f4les @@ -85,8 +84,8 @@ capability.CreateModifyDestroyRoles.title=Cr\u00e9er Modifier D\u00e9truire des capability.CreateModifyDestroyUsersAndGroups.title=Cr\u00e9er Modifier D\u00e9truire des utilisateurs et des groupes capability.PasswordControl.title=Contr\u00f4le des mots de passe capability.DisplayRightsReport.title=Afficher le rapport sur les droits -capability.ManageAccessControls.title=Affectation de r\u00f4les aux groupes et utilisateurs -capability.ManageAccessRights.title=G\u00e9rer les permissions +capability.ManageAccessControls.title=G\u00e9rer les contr\u00f4les d'acc\u00e8s +capability.ManageAccessRights.title=G\u00e9rer les droits d'acc\u00e8s # Configuration capability.group.config.title=Configuration diff --git a/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/capability-service_it.properties b/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/capability-service_it.properties index 330dd2d888..e5ab2e69c5 100644 --- a/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/capability-service_it.properties +++ b/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/capability-service_it.properties @@ -8,7 +8,6 @@ capability.RequestRecordInformation.title=Richiedi informazioni record capability.RejectRecords.title=Respingi record capability.FileUnfiledRecords.title=Archivia record non archiviati capability.LinkToRecords.title=Collega record -capability.DeleteLinks.title=Scollega record # Metadata Control capability.group.metadataControl.title=Controllo metadati @@ -33,6 +32,7 @@ capability.PlanningReviewCycles.title=Pianificazione cicli di revisione # References and Links capability.group.references.title=Riferimenti capability.ChangeOrDeleteReferences.title=Cambia o elimina riferimenti +capability.DeleteLinks.title=Elimina collegamenti # Events capability.group.events.title=Eventi @@ -56,7 +56,6 @@ capability.DeleteRecords.title=Elimina record capability.TriggerAnEvent.title=Attiva un evento capability.FileDestructionReport.title=Archivia report di eliminazione permanente capability.FileTransferReport.title=Archivia report di trasferimento -capability.EndRetention.title=Termina conservazione # Hold Controls capability.group.holdControls.title=Sospendi controlli @@ -85,8 +84,8 @@ capability.CreateModifyDestroyRoles.title=Crea Modifica Elimina definitivamente capability.CreateModifyDestroyUsersAndGroups.title=Crea Modifica Elimina definitivamente utenti e gruppi capability.PasswordControl.title=Controllo password capability.DisplayRightsReport.title=Mostra report diritti -capability.ManageAccessControls.title=Assegnazione gruppo e ruolo utente -capability.ManageAccessRights.title=Gestisci permessi +capability.ManageAccessControls.title=Gestisci controlli di accesso +capability.ManageAccessRights.title=Gestisci diritti di accesso # Configuration capability.group.config.title=Configurazione diff --git a/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/capability-service_ja.properties b/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/capability-service_ja.properties index 211f9b0ddc..f247997b61 100644 --- a/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/capability-service_ja.properties +++ b/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/capability-service_ja.properties @@ -8,7 +8,6 @@ capability.RequestRecordInformation.title=\u30ec\u30b3\u30fc\u30c9\u60c5\u5831\u capability.RejectRecords.title=\u30ec\u30b3\u30fc\u30c9\u306e\u5374\u4e0b capability.FileUnfiledRecords.title=\u672a\u6574\u7406\u306e\u30ec\u30b3\u30fc\u30c9\u306e\u6574\u7406\u4fdd\u7ba1 capability.LinkToRecords.title=\u30ec\u30b3\u30fc\u30c9\u306e\u30ea\u30f3\u30af -capability.DeleteLinks.title=\u30ec\u30b3\u30fc\u30c9\u306e\u30ea\u30f3\u30af\u306e\u89e3\u9664 # Metadata Control capability.group.metadataControl.title=\u30e1\u30bf\u30c7\u30fc\u30bf\u306e\u30b3\u30f3\u30c8\u30ed\u30fc\u30eb @@ -33,6 +32,7 @@ capability.PlanningReviewCycles.title=\u30ec\u30d3\u30e5\u30fc\u30b5\u30a4\u30af # References and Links capability.group.references.title=\u53c2\u7167 capability.ChangeOrDeleteReferences.title=\u53c2\u7167\u306e\u5909\u66f4\u307e\u305f\u306f\u524a\u9664 +capability.DeleteLinks.title=\u30ea\u30f3\u30af\u306e\u524a\u9664 # Events capability.group.events.title=\u30a4\u30d9\u30f3\u30c8 @@ -56,7 +56,6 @@ capability.DeleteRecords.title=\u30ec\u30b3\u30fc\u30c9\u306e\u524a\u9664 capability.TriggerAnEvent.title=\u30a4\u30d9\u30f3\u30c8\u306e\u30c8\u30ea\u30ac\u30fc capability.FileDestructionReport.title=\u7834\u68c4\u30ec\u30dd\u30fc\u30c8\u306e\u6574\u7406\u4fdd\u7ba1 capability.FileTransferReport.title=\u8ee2\u9001\u30ec\u30dd\u30fc\u30c8\u306e\u6574\u7406\u4fdd\u7ba1 -capability.EndRetention.title=\u4fdd\u6301\u306e\u7d42\u4e86 # Hold Controls capability.group.holdControls.title=\u30b3\u30f3\u30c8\u30ed\u30fc\u30eb\u306e\u30db\u30fc\u30eb\u30c9 @@ -85,8 +84,8 @@ capability.CreateModifyDestroyRoles.title=\u5f79\u5272\u306e\u4f5c\u6210/\u5909\ capability.CreateModifyDestroyUsersAndGroups.title=\u30e6\u30fc\u30b6\u30fc\u3068\u30b0\u30eb\u30fc\u30d7\u306e\u4f5c\u6210/\u5909\u66f4/\u7834\u68c4 capability.PasswordControl.title=\u30d1\u30b9\u30ef\u30fc\u30c9\u306e\u30b3\u30f3\u30c8\u30ed\u30fc\u30eb capability.DisplayRightsReport.title=\u6a29\u5229\u30ec\u30dd\u30fc\u30c8\u306e\u8868\u793a -capability.ManageAccessControls.title=\u30b0\u30eb\u30fc\u30d7\u3068\u30e6\u30fc\u30b6\u30fc\u30ed\u30fc\u30eb\u306e\u5272\u308a\u5f53\u3066 -capability.ManageAccessRights.title=\u6a29\u9650\u306e\u7ba1\u7406 +capability.ManageAccessControls.title=\u30a2\u30af\u30bb\u30b9\u30b3\u30f3\u30c8\u30ed\u30fc\u30eb\u306e\u7ba1\u7406 +capability.ManageAccessRights.title=\u30a2\u30af\u30bb\u30b9\u6a29\u306e\u7ba1\u7406 # Configuration capability.group.config.title=\u8a2d\u5b9a diff --git a/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/capability-service_nb.properties b/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/capability-service_nb.properties deleted file mode 100644 index 82ca8fd257..0000000000 --- a/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/capability-service_nb.properties +++ /dev/null @@ -1,105 +0,0 @@ -# Records -capability.group.records.title=Oppf\u00f8ringer -capability.DeclareRecords.title=Fullf\u00f8r oppf\u00f8ringer -capability.ViewRecords.title=Vis oppf\u00f8ringer -capability.UndeclareRecords.title=\u00c5pne oppf\u00f8ringer p\u00e5 nytt -capability.CreateRecords.title=Opprett oppf\u00f8ringer -capability.RequestRecordInformation.title=Be om oppf\u00f8ringsinformasjon -capability.RejectRecords.title=Avvis oppf\u00f8ringer -capability.FileUnfiledRecords.title=Registrer oppf\u00f8ringer som ikke er registrert -capability.LinkToRecords.title=Koble oppf\u00f8ringer -capability.DeleteLinks.title=Koble fra oppf\u00f8ringer - -# Metadata Control -capability.group.metadataControl.title=Metadatakontroll -capability.EditRecordMetadata.title=Rediger registrering av metadata -capability.EditDeclaredRecordMetadata.title=Rediger fullf\u00f8rte registrerte metadata -capability.EditNonRecordMetadata.title=Rediger metadata som ikke er registrert -capability.MoveRecords.title=Flytt oppf\u00f8ringer - -# Folder Control -capability.group.folderControl.title=Mappekontroll -capability.CreateModifyDestroyFolders.title=Opprett Endre Destruer mapper -capability.CloseFolders.title=Lukk mapper -capability.ReOpenFolders.title=\u00c5pne mapper p\u00e5 nytt -capability.DeclareRecordsInClosedFolders.title=Fullf\u00f8r oppf\u00f8ringer i lukkede mapper - -# Vital Records -capability.group.vitalRecords.title=Sv\u00e6t viktige oppf\u00f8ringer -capability.UpdateVitalRecordCycleInformation.title=Oppdater syklusinformasjon til de sv\u00e6rt viktige oppf\u00f8ringene -capability.CycleVitalRecords.title=Sirkuler sv\u00e6rt viktige oppf\u00f8ringer -capability.PlanningReviewCycles.title=Planlegge gjennomgangsykluser - -# References and Links -capability.group.references.title=Referanser -capability.ChangeOrDeleteReferences.title=Endre eller slett referanser - -# Events -capability.group.events.title=Hendelser -capability.CreateModifyDestroyEvents.title=Opprett Endre Destruer hendelser -capability.AddModifyEventDates.title=Legg til Endre hendelsesdatoer - -# Cutoff -capability.group.cutoff.title=Cut off -capability.ApproveRecordsScheduledForCutoff.title=Godkjenn oppf\u00f8ringer der planen er cut off -capability.CreateModifyRecordsInCutoffFolders.title=Opprett Endre oppf\u00f8ringer i cut off-mapper - -# Disposition and Transfers -capability.group.dispositionAndTransfers.title=Disposisjoner og overf\u00f8ringer -capability.UpdateTriggerDates.title=Oppdater utl\u00f8serdatoer -capability.ManuallyChangeDispositionDates.title=Endre disposisjonsdatoer manuelt -capability.AuthorizeNominatedTransfers.title=Godkjenn nominerte overf\u00f8ringer -capability.AuthorizeAllTransfers.title=Godkjenn alle overf\u00f8ringer -capability.DestroyRecordsScheduledForDestruction.title=Destruer oppf\u00f8ring eller oppf\u00f8ringsmappe der planen er \u00e5 destruere den -capability.DestroyRecords.title=Destruer oppf\u00f8ringer -capability.DeleteRecords.title=Slett oppf\u00f8ringer -capability.TriggerAnEvent.title=Utl\u00f8s en hendelse -capability.FileDestructionReport.title=Fildestruksjonsrapport -capability.FileTransferReport.title=Filoverf\u00f8ringsrapport -capability.EndRetention.title=Avslutt retensjon - -# Hold Controls -capability.group.holdControls.title=Hold kontroller -capability.ExtendRetentionPeriodOrFreeze.title=Forleng oppbevaringstiden eller frys -capability.Unfreeze.title=T\u00f8 opp -capability.ViewUpdateReasonsForFreeze.title=Vis oppdatering av \u00e5rsaker til \u00e5 fryse -capability.CreateHold.title=Opprett hold -capability.AddToHold.title=Legg til hold -capability.RemoveFromHold.title=Fjern fra hold -capability.FileHoldReport.title=Filholdrapport -capability.DeleteHold.title=Slett hold -capability.EditHold.title=Rediger hold - -# Audit -capability.group.audit.title=Revisjon -capability.DeclareAuditAsRecord.title=Erkl\u00e6r revisjon som oppf\u00f8ring -capability.EnableDisableAuditByTypes.title=Aktiver/Deaktiver revisjon etter typer -capability.DeleteAudit.title=Slett revisjon -capability.SelectAuditMetadata.title=Velg revisjon av metadata -capability.AccessAudit.title=G\u00e5 til revisjon -capability.ExportAudit.title=Eksporter revisjon - -# Security -capability.group.security.title=Sikkerhet -capability.CreateModifyDestroyRoles.title=Opprett Endre Destruer roller -capability.CreateModifyDestroyUsersAndGroups.title=Opprett Endre Destruer brukere og grupper -capability.PasswordControl.title=Passordkontroll -capability.DisplayRightsReport.title=Vis rettighetsrapport -capability.ManageAccessControls.title=Gruppe- og brukerrolletildeling -capability.ManageAccessRights.title=Administrer tillatelser - -# Configuration -capability.group.config.title=Konfigurasjon -capability.CreateModifyDestroyFileplanMetadata.title=Opprett Endre Destruer filplanmetadata -capability.CreateModifyDestroyFileplanTypes.title=Opprett Endre Destruer filplantyper -capability.CreateModifyDestroyRecordTypes.title=Opprett Endre Destruer oppf\u00f8ringstyper -capability.CreateAndAssociateSelectionLists.title=Opprett og koble valglister -capability.EditSelectionLists.title=Rediger valglister -capability.CreateModifyDestroyReferenceTypes.title=Opprett Endre Destruer referansetyper -capability.AttachRulesToMetadataProperties.title=Legg ved regler til metadataegenskaper -capability.MakeOptionalParametersMandatory.title=P\u00e5legg valgfrie parametere -capability.MapEmailMetadata.title=Koble e-postmetadata - -# Rules -capability.group.rules.title=Regler -capability.ManageRules.title=Administrer regler \ No newline at end of file diff --git a/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/capability-service_nl.properties b/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/capability-service_nl.properties index df0e74c718..5caa5e7ee9 100755 --- a/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/capability-service_nl.properties +++ b/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/capability-service_nl.properties @@ -8,7 +8,6 @@ capability.RequestRecordInformation.title=Recordgegevens opvragen capability.RejectRecords.title=Records afwijzen capability.FileUnfiledRecords.title=Niet gearchiveerde records archiveren capability.LinkToRecords.title=Records koppelen -capability.DeleteLinks.title=Recordkoppeling opheffen # Metadata Control capability.group.metadataControl.title=Metagegevensbeheer @@ -33,11 +32,12 @@ capability.PlanningReviewCycles.title=Planning revisiecycli # References and Links capability.group.references.title=Verwijzingen capability.ChangeOrDeleteReferences.title=Verwijzingen veranderen of verwijderen +capability.DeleteLinks.title=Koppelingen verwijderen # Events capability.group.events.title=Gebeurtenissen capability.CreateModifyDestroyEvents.title=Gebeurtenissen maken aanpassen vernietigen -capability.AddModifyEventDates.title=Datums van gebeurtenis wijzigen toevoegen +capability.AddModifyEventDates.title=Data van gebeurtenis wijzigen toevoegen # Cutoff capability.group.cutoff.title=Afsluiten @@ -45,9 +45,9 @@ capability.ApproveRecordsScheduledForCutoff.title=Records goedkeuren die zijn in capability.CreateModifyRecordsInCutoffFolders.title=Veranderingsrecords in afsluitmappen maken # Disposition and Transfers -capability.group.dispositionAndTransfers.title=Beschikking en overzettingen -capability.UpdateTriggerDates.title=Triggerdatums bijwerken -capability.ManuallyChangeDispositionDates.title=Beschikkingsdatums handmatig wijzigen +capability.group.dispositionAndTransfers.title=Archivering en overzetten +capability.UpdateTriggerDates.title=Triggerdata bijwerken +capability.ManuallyChangeDispositionDates.title=Archiveringsdata handmatig veranderen capability.AuthorizeNominatedTransfers.title=Genomineerde overzettingen autoriseren capability.AuthorizeAllTransfers.title=Alle overzettingen autoriseren capability.DestroyRecordsScheduledForDestruction.title=Record of archiefmap vernietigen die is ingepland voor vernietiging @@ -56,7 +56,6 @@ capability.DeleteRecords.title=Records verwijderen capability.TriggerAnEvent.title=Een gebeurtenis triggeren capability.FileDestructionReport.title=Vernietigingsrapport archiveren capability.FileTransferReport.title=Overzetrapport archiveren -capability.EndRetention.title=Retentie be\u00ebindigen # Hold Controls capability.group.holdControls.title=Wachtstandbeheer @@ -85,8 +84,8 @@ capability.CreateModifyDestroyRoles.title=Rollen maken aanpassen vernietigen capability.CreateModifyDestroyUsersAndGroups.title=Gebruikers en groepen maken aanpassen vernietigen capability.PasswordControl.title=Wachtwoordbeheer capability.DisplayRightsReport.title=Rechtenrapport weergeven -capability.ManageAccessControls.title=Groeps- en gebruikersroltoewijzing -capability.ManageAccessRights.title=Rechten beheren +capability.ManageAccessControls.title=Toegangsopties beheren +capability.ManageAccessRights.title=Toegangsrechten beheren # Configuration capability.group.config.title=Configuratie diff --git a/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/capability-service_pt_BR.properties b/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/capability-service_pt_BR.properties index 4f55ca50d5..e4b78c3dd8 100644 --- a/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/capability-service_pt_BR.properties +++ b/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/capability-service_pt_BR.properties @@ -8,7 +8,6 @@ capability.RequestRecordInformation.title=Solicitar informa\u00e7\u00f5es de doc capability.RejectRecords.title=Rejeitar documentos arquiv\u00edsticos capability.FileUnfiledRecords.title=Arquivar documentos arquiv\u00edsticos n\u00e3o arquivados capability.LinkToRecords.title=Vincular documentos arquiv\u00edsticos -capability.DeleteLinks.title=Anular v\u00ednculo dos documentos arquiv\u00edsticos # Metadata Control capability.group.metadataControl.title=Controle de metadados @@ -33,6 +32,7 @@ capability.PlanningReviewCycles.title=Ciclos de revis\u00e3o de planejamento # References and Links capability.group.references.title=Refer\u00eancias capability.ChangeOrDeleteReferences.title=Alterar ou excluir refer\u00eancias +capability.DeleteLinks.title=Excluir links # Events capability.group.events.title=Eventos @@ -56,7 +56,6 @@ capability.DeleteRecords.title=Excluir documentos arquiv\u00edsticos capability.TriggerAnEvent.title=Disparar um evento capability.FileDestructionReport.title=Relat\u00f3rio de destrui\u00e7\u00e3o de arquivos capability.FileTransferReport.title=Relat\u00f3rio de transfer\u00eancia de arquivos -capability.EndRetention.title=Encerrar reten\u00e7\u00e3o # Hold Controls capability.group.holdControls.title=Controles de espera @@ -85,8 +84,8 @@ capability.CreateModifyDestroyRoles.title=Criar Modificar Destruir fun\u00e7\u00 capability.CreateModifyDestroyUsersAndGroups.title=Criar Modificar Destruir usu\u00e1rios e grupos capability.PasswordControl.title=Controle de senha capability.DisplayRightsReport.title=Exibir relat\u00f3rio de direitos -capability.ManageAccessControls.title=Grupo e atribui\u00e7\u00e3o de cargo do usu\u00e1rio -capability.ManageAccessRights.title=Gerenciar permiss\u00f5es +capability.ManageAccessControls.title=Gerenciar controles de acesso +capability.ManageAccessRights.title=Gerenciar direitos de acesso # Configuration capability.group.config.title=Configura\u00e7\u00e3o diff --git a/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/capability-service_ru.properties b/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/capability-service_ru.properties index 31c94e2648..02d6d06d20 100644 --- a/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/capability-service_ru.properties +++ b/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/capability-service_ru.properties @@ -8,7 +8,6 @@ capability.RequestRecordInformation.title=\u0417\u0430\u043f\u0440\u043e\u0441 \ capability.RejectRecords.title=\u041e\u0442\u043a\u043b\u043e\u043d\u0438\u0442\u044c \u0437\u0430\u043f\u0438\u0441\u0438 capability.FileUnfiledRecords.title=\u0421\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c \u043d\u0435\u0437\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u043d\u044b\u0435 \u0437\u0430\u043f\u0438\u0441\u0438 capability.LinkToRecords.title=\u0421\u0432\u044f\u0437\u0430\u0442\u044c \u0437\u0430\u043f\u0438\u0441\u0438 -capability.DeleteLinks.title=\u0420\u0430\u0437\u043e\u0440\u0432\u0430\u0442\u044c \u0441\u0432\u044f\u0437\u0438 \u0441 \u0437\u0430\u043f\u0438\u0441\u044f\u043c\u0438 # Metadata Control capability.group.metadataControl.title=\u0423\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043c\u0435\u0442\u0430\u0434\u0430\u043d\u043d\u044b\u043c\u0438 @@ -33,6 +32,7 @@ capability.PlanningReviewCycles.title=\u041f\u043b\u0430\u043d\u0438\u0440\u043e # References and Links capability.group.references.title=\u0421\u0441\u044b\u043b\u043a\u0438 capability.ChangeOrDeleteReferences.title=\u0418\u0437\u043c\u0435\u043d\u0438\u0442\u044c \u0438\u043b\u0438 \u0443\u0434\u0430\u043b\u0438\u0442\u044c \u0441\u0441\u044b\u043b\u043a\u0438 +capability.DeleteLinks.title=\u0423\u0434\u0430\u043b\u0438\u0442\u044c \u0441\u0441\u044b\u043b\u043a\u0438 # Events capability.group.events.title=\u0421\u043e\u0431\u044b\u0442\u0438\u044f @@ -42,7 +42,7 @@ capability.AddModifyEventDates.title=\u0414\u043e\u0431\u0430\u0432\u0438\u0442\ # Cutoff capability.group.cutoff.title=\u041e\u0442\u0440\u0435\u0437\u0430\u0442\u044c capability.ApproveRecordsScheduledForCutoff.title=\u041f\u043e\u0434\u0442\u0432\u0435\u0440\u0434\u0438\u0442\u044c \u0437\u0430\u043f\u0438\u0441\u0438, \u0437\u0430\u043f\u043b\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u043f\u043e\u0434 \u043e\u0442\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 -capability.CreateModifyRecordsInCutoffFolders.title=\u0421\u043e\u0437\u0434\u0430\u0442\u044c, \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c \u0437\u0430\u043f\u0438\u0441\u0438 \u0432 \u043e\u0442\u043a\u043b\u044e\u0447\u0435\u043d\u043d\u044b\u0445 \u043f\u0430\u043f\u043a\u0430\u0445 +capability.CreateModifyRecordsInCutoffFolders.title=\u0421\u043e\u0437\u0434\u0430\u0442\u044c, \u0438\u0437\u043c\u0435\u043d\u0438 \u0442\u044c \u0437\u0430\u043f\u0438\u0441\u0438 \u0432 \u043e\u0442\u043a\u043 b\u044e\u0447\u0435\u043d\u043d\u044b\u0445 \u043f\u0430\u043f\u043a\u0430\u0445 # Disposition and Transfers capability.group.dispositionAndTransfers.title=\u0420\u0430\u0437\u043c\u0435\u0449\u0435\u043d\u0438\u0435 \u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0438 @@ -56,7 +56,6 @@ capability.DeleteRecords.title=\u0423\u0434\u0430\u043b\u0438\u0442\u044c \u0417 capability.TriggerAnEvent.title=\u0410\u043a\u0442\u0438\u0432\u0430\u0446\u0438\u044f \u0441\u043e\u0431\u044b\u0442\u0438\u044f capability.FileDestructionReport.title=\u041e\u0442\u0447\u0435\u0442 \u043e\u0431 \u0443\u043d\u0438\u0447\u0442\u043e\u0436\u0435\u043d\u0438\u0438 \u0444\u0430\u0439\u043b\u0430 capability.FileTransferReport.title=\u041e\u0442\u0447\u0435\u0442 \u043e \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0435 \u0444\u0430\u0439\u043b\u0430 -capability.EndRetention.title=\u0417\u0430\u0432\u0435\u0440\u0448\u0438\u0442\u044c \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u0435 # Hold Controls capability.group.holdControls.title=\u0423\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0443\u0434\u0435\u0440\u0436\u0430\u043d\u0438\u0435\u043c @@ -67,8 +66,8 @@ capability.CreateHold.title=\u0421\u043e\u0437\u0434\u0430\u0442\u044c \u0443\u0 capability.AddToHold.title=\u0417\u0430\u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u0430\u0442\u044c capability.RemoveFromHold.title=\u0420\u0430\u0437\u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u0430\u0442\u044c capability.FileHoldReport.title=\u041e\u0442\u0447\u0435\u0442 \u043e\u0431 \u0443\u0434\u0435\u0440\u0436\u0430\u043d\u0438\u0438 \u0444\u0430\u0439\u043b\u0430 -capability.DeleteHold.title=\u0423\u0434\u0430\u043b\u0438\u0442\u044c \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u0443 -capability.EditHold.title=\u0420\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u0443 +capability.DeleteHold.title=\u0423\u0434\u0430\u043b\u0438\u0442\u044c \u0443\u0434\u0435\u0440\u0436\u0430\u043d\u0438\u0435 +capability.EditHold.title=\u0420\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0443\u0434\u0435\u0440\u0436\u0430\u043d\u0438\u0435 # Audit capability.group.audit.title=\u0410\u0443\u0434\u0438\u0442 @@ -85,8 +84,8 @@ capability.CreateModifyDestroyRoles.title=\u0421\u043e\u0437\u0434\u0430\u0442\u capability.CreateModifyDestroyUsersAndGroups.title=\u0421\u043e\u0437\u0434\u0430\u0442\u044c, \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c, \u0443\u043d\u0438\u0447\u0442\u043e\u0436\u0438\u0442\u044c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439 \u0438 \u0433\u0440\u0443\u043f\u043f\u044b capability.PasswordControl.title=\u0423\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043f\u0430\u0440\u043e\u043b\u044f\u043c\u0438 capability.DisplayRightsReport.title=\u041e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u043e\u0442\u0447\u0435\u0442\u0430 \u043f\u043e \u043f\u0440\u0430\u0432\u0430\u043c -capability.ManageAccessControls.title=\u041d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0440\u043e\u043b\u0438 \u0433\u0440\u0443\u043f\u043f\u0435 \u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044e -capability.ManageAccessRights.title=\u041d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u043f\u0440\u0430\u0432\u0430 \u0434\u043e\u0441\u0442\u0443\u043f\u0430 +capability.ManageAccessControls.title=\u041a\u043e\u043d\u0442\u0440\u043e\u043b\u044c \u0437\u0430 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435\u043c \u0434\u043e\u0441\u0442\u0443\u043f\u043e\u043c +capability.ManageAccessRights.title=\u041f\u0440\u0430\u0432\u0430 \u043d\u0430 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0434\u043e\u0441\u0442\u0443\u043f\u043e\u043c # Configuration capability.group.config.title=\u041a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044f diff --git a/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/capability-service_zh_CN.properties b/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/capability-service_zh_CN.properties index ff101b77f7..b8be8e680c 100644 --- a/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/capability-service_zh_CN.properties +++ b/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/capability-service_zh_CN.properties @@ -8,7 +8,6 @@ capability.RequestRecordInformation.title=\u8bf7\u6c42\u8bb0\u5f55\u4fe1\u606f capability.RejectRecords.title=\u62d2\u7edd\u8bb0\u5f55 capability.FileUnfiledRecords.title=\u5bf9\u672a\u7acb\u5377\u7684\u8bb0\u5f55\u7acb\u5377 capability.LinkToRecords.title=\u94fe\u63a5\u8bb0\u5f55 -capability.DeleteLinks.title=\u53d6\u6d88\u8bb0\u5f55\u7684\u94fe\u63a5 # Metadata Control capability.group.metadataControl.title=\u5143\u6570\u636e\u63a7\u5236 @@ -33,6 +32,7 @@ capability.PlanningReviewCycles.title=\u8ba1\u5212\u5ba1\u67e5\u5468\u671f # References and Links capability.group.references.title=\u53c2\u8003 capability.ChangeOrDeleteReferences.title=\u66f4\u6539\u6216\u5220\u9664\u53c2\u8003 +capability.DeleteLinks.title=\u5220\u9664\u94fe\u63a5 # Events capability.group.events.title=\u4e8b\u4ef6 @@ -56,7 +56,6 @@ capability.DeleteRecords.title=\u5220\u9664\u8bb0\u5f55 capability.TriggerAnEvent.title=\u89e6\u53d1\u4e8b\u4ef6 capability.FileDestructionReport.title=\u7acb\u5377\u9500\u6bc1\u62a5\u544a capability.FileTransferReport.title=\u7acb\u5377\u79fb\u4ea4\u62a5\u544a -capability.EndRetention.title=\u7ed3\u675f\u4fdd\u7559 # Hold Controls capability.group.holdControls.title=\u4fdd\u5b58\u63a7\u5236 @@ -85,8 +84,8 @@ capability.CreateModifyDestroyRoles.title=\u521b\u5efa\u4fee\u6539\u9500\u6bc1\u capability.CreateModifyDestroyUsersAndGroups.title=\u521b\u5efa\u4fee\u6539\u9500\u6bc1\u7528\u6237\u548c\u7ec4 capability.PasswordControl.title=\u5bc6\u7801\u63a7\u5236 capability.DisplayRightsReport.title=\u663e\u793a\u6743\u9650\u62a5\u544a -capability.ManageAccessControls.title=\u7ec4\u548c\u7528\u6237\u89d2\u8272\u5206\u914d -capability.ManageAccessRights.title=\u7ba1\u7406\u6743\u9650 +capability.ManageAccessControls.title=\u7ba1\u7406\u8bbf\u95ee\u63a7\u5236 +capability.ManageAccessRights.title=\u7ba1\u7406\u8bbf\u95ee\u6743\u9650 # Configuration capability.group.config.title=\u914d\u7f6e diff --git a/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/dataset-service_nb.properties b/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/dataset-service_nb.properties deleted file mode 100644 index cfcae4568d..0000000000 --- a/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/dataset-service_nb.properties +++ /dev/null @@ -1 +0,0 @@ -dataset.dod5015.label=DOD 5015 eksempel p\u00e5 data \ No newline at end of file diff --git a/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/notification-service_nb.properties b/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/notification-service_nb.properties deleted file mode 100644 index 38c9c0886f..0000000000 --- a/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/notification-service_nb.properties +++ /dev/null @@ -1,3 +0,0 @@ -notification.dueforreview.subject=Oppf\u00f8ringer med melding der det skal v\u00e6re gjennomgang -notification.superseded.subject=Oppf\u00f8ring erstattet melding -notification.rejected.subject=Oppf\u00f8ring avviste melding \ No newline at end of file diff --git a/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/records-management-service.properties b/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/records-management-service.properties index 70f6712de5..58ebfc0ce5 100644 --- a/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/records-management-service.properties +++ b/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/records-management-service.properties @@ -16,6 +16,4 @@ rm.service.record-folder-type=Can't create record folder, because the provided t rm.service.not-record=The node {0} is not a record. rm.service.vital-def-missing=Vital record definition aspect is not present on node. (nodeRef={0}) rm.service.close-record-folder-not-folder=The record folder couldn't be closed because it's not defined as a record folder.(nodeRef={0}) -rm.service.node-has-aspect=The node {0} has already the aspect {1}. -rm.service.final-version=Final -rm.service.final-version-description=The final archived record version \ No newline at end of file +rm.service.node-has-aspect=The node {0} has already the aspect {1}. \ No newline at end of file diff --git a/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/records-management-service_de.properties b/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/records-management-service_de.properties index bf286e2463..cf7d7558d7 100644 --- a/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/records-management-service_de.properties +++ b/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/records-management-service_de.properties @@ -16,6 +16,4 @@ rm.service.record-folder-type=Record-Ordner kann nicht erstellt werden, da der a rm.service.not-record=Knoten {0} ist kein Record. rm.service.vital-def-missing=Definitionsaspekt von besonders relevantem Record ist auf dem Knoten nicht vorhanden. (nodeRef={0}) rm.service.close-record-folder-not-folder=Der Record-Ordner konnte nicht geschlossen werden, da er nicht als Record-Ordner definiert ist. (nodeRef={0}) -rm.service.node-has-aspect=Der Knoten {0} hat bereits den Aspekt {1}. -rm.service.final-version=Endg\u00fcltig -rm.service.final-version-description=Die endg\u00fcltige archivierte Version des Records \ No newline at end of file +rm.service.node-has-aspect=Der Knoten {0} hat bereits den Aspekt {1}. \ No newline at end of file diff --git a/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/records-management-service_es.properties b/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/records-management-service_es.properties index 445a34aa97..b7992f4535 100644 --- a/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/records-management-service_es.properties +++ b/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/records-management-service_es.properties @@ -1,21 +1,19 @@ rm.service.error-add-content-container=No se puede agregar contenido a un contenedor de documentos de archivo. Utilice carpetas de documentos de archivo para archivar contenido. rm.service.update-disposition-action-def=No se puede actualizar la definici\u00f3n de acciones de disposici\u00f3n porque se est\u00e1 publicando una actualizaci\u00f3n. -rm.service.set-id=No se puede establecer el valor de la propiedad identificadora {0} porque es de solo lectura. +rm.service.set-id=No se puede establecer el valor de la propiedad identificadora ''{0}'' porque es de solo lectura. rm.service.path-node=No se puede obtener ruta. (nodeRef={0}) -rm.service.invalid-rm-node=El nodo de gesti\u00f3n de documentos de archivo no es v\u00e1lido porque el aspecto {0} no est\u00e1 presente. +rm.service.invalid-rm-node=El nodo de gesti\u00f3n de documentos de archivo no es v\u00e1lido porque el aspecto ''{0}'' no est\u00e1 presente. rm.service.no-root=No se puede encontrar una ra\u00edz de gesti\u00f3n de documentos de archivo. rm.service.dup-root=No se puede crear una ra\u00edz de gesti\u00f3n de documentos de archivo porque ya existe una en esta jerarqu\u00eda. -rm.service.root-type=No se puede crear una ra\u00edz de gesti\u00f3n de documentos de archivo porque el tipo {0} no es un subtipo de rm:recordsManagementRootContainer. +rm.service.root-type=No se puede crear una ra\u00edz de gesti\u00f3n de documentos de archivo porque el tipo ''{0}'' no es un subtipo de rm:recordsManagementRootContainer. rm.service.container-parent-type=No se puede crear un contenedor de gesti\u00f3n de documentos de archivo porque el padre no era un subtipo de rm:recordsManagement (parentType={0}). -rm.service.container-type=No se puede crear un contenedor de gesti\u00f3n de documentos de archivo porque el tipo {0} no es un subtipo de rm:recordsManagementContainer. +rm.service.container-type=No se puede crear un contenedor de gesti\u00f3n de documentos de archivo porque el tipo ''{0}'' no es un subtipo de rm:recordsManagementContainer. rm.service.container-expected=Se espera un nodo de referencia en un nodo rm:recordsManagementContainer. rm.service.record-folder-expected=Se espera un nodo de referencia en un nodo rm:recordFolder. rm.service.parent-record-folder-root=No se puede crear una carpeta de documentos de archivo porque el padre es una ra\u00edz de gesti\u00f3n de documentos de archivo. rm.service.parent-record-folder-type=No se puede crear una carpeta de documentos de archivo porque el padre no era un subtipo de rm:recordsManagementContainer. (parentType={0}) rm.service.record-folder-type=No se puede crear una carpeta de documentos de archivo porque el tipo proporcionado no es un subtipo de rm:recordFolder. (type={0}) -rm.service.not-record=El nodo {0} no es un documento de archivo. +rm.service.not-record=El nodo ''{0}'' no es un documento de archivo. rm.service.vital-def-missing=El aspecto de definici\u00f3n de documento de archivo vital no est\u00e1 presenta en el nodo. (nodeRef={0}) rm.service.close-record-folder-not-folder=No se pudo cerrar la carpeta de documentos de archivo porque no est\u00e1 definida como una carpeta de documentos de archivo.(nodeRef={0}) -rm.service.node-has-aspect=El nodo {0} ya tiene el aspecto {1}. -rm.service.final-version=Final -rm.service.final-version-description=La versi\u00f3n final del documento de archivo archivado \ No newline at end of file +rm.service.node-has-aspect=El nodo ''{0}'' ya tiene el aspecto {1}. \ No newline at end of file diff --git a/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/records-management-service_fr.properties b/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/records-management-service_fr.properties index 495b595c4c..b9edeae5e9 100644 --- a/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/records-management-service_fr.properties +++ b/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/records-management-service_fr.properties @@ -6,7 +6,7 @@ rm.service.invalid-rm-node=N\u0153ud non valide de gestion des archives car l''a rm.service.no-root=Impossible de trouver la racine du site de gestion des archives. rm.service.dup-root=Impossible de cr\u00e9er la racine du site de gestion des archives car il en existe d\u00e9j\u00e0 une dans cette hi\u00e9rarchie. rm.service.root-type=Impossible de cr\u00e9er la racine du site de gestion des archives car le type {0} n''est pas un sous-type de rm:recordsManagementRootContainer. -rm.service.container-parent-type=Impossible de cr\u00e9er le conteneur de gestion des archives car le parent n''\u00e9tait pas un sous-type de rm:recordsManagement (parentType={0}) +rm.service.container-parent-type=Impossible de cr\u00e9er le conteneur de gestion des archives car le parent n''\u00e9tait pas un sous--type de rm:recordsManagement (parentType={0}) rm.service.container-type=Impossible de cr\u00e9er le conteneur de gestion des archives car le type {0} n''est pas un sous-type de rm:recordsManagementContainer. rm.service.container-expected=La r\u00e9f\u00e9rence \u00e0 un n\u0153ud rm:recordsManagementContainer \u00e9tait attendue. rm.service.record-folder-expected=La r\u00e9f\u00e9rence \u00e0 un n\u0153ud rm:recordFolder \u00e9tait attendue. @@ -16,6 +16,4 @@ rm.service.record-folder-type=Impossible de cr\u00e9er un dossier d''archives ca rm.service.not-record=Le n\u0153ud {0} n''est pas un document d''archives. rm.service.vital-def-missing=L''aspect de d\u00e9finition de document d''archives essentiel n''est pas pr\u00e9sent sur le n\u0153ud. (nodeRef={0}) rm.service.close-record-folder-not-folder=Le dossier d''archives n''a pas pu \u00eatre ferm\u00e9, car il n''est pas d\u00e9fini comme dossier d''archives.(nodeRef={0}) -rm.service.node-has-aspect=Le n\u0153ud {0} a d\u00e9j\u00e0 l''aspect {1}. -rm.service.final-version=Finale -rm.service.final-version-description=Version finale du document archiv\u00e9 \ No newline at end of file +rm.service.node-has-aspect=Le n\u0153ud {0} a d\u00e9j\u00e0 l''aspect {1}. \ No newline at end of file diff --git a/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/records-management-service_it.properties b/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/records-management-service_it.properties index bcbc46434d..8b29afd323 100644 --- a/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/records-management-service_it.properties +++ b/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/records-management-service_it.properties @@ -16,6 +16,4 @@ rm.service.record-folder-type=Impossibile creare una cartella di record, poich\u rm.service.not-record=Il nodo {0} non \u00e8 un record. rm.service.vital-def-missing=L''aspetto di definizione di record fondamentale non \u00e8 presente su nodo. (nodeRef={0}) rm.service.close-record-folder-not-folder=Non \u00e8 stato possibile chiudere la cartella di record, poich\u00e9 non \u00e8 definita come cartella di record.(nodeRef={0}) -rm.service.node-has-aspect=Il nodo {0} presenta gi\u00e0 l''aspetto {1}. -rm.service.final-version=Finale -rm.service.final-version-description=Versione del record archiviata finale \ No newline at end of file +rm.service.node-has-aspect=Il nodo {0} presenta gi\u00e0 l''aspetto {1}. \ No newline at end of file diff --git a/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/records-management-service_ja.properties b/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/records-management-service_ja.properties index fca3a7c66f..e4dc5c2bbd 100644 --- a/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/records-management-service_ja.properties +++ b/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/records-management-service_ja.properties @@ -1,21 +1,19 @@ -rm.service.error-add-content-container=\u30b3\u30f3\u30c6\u30f3\u30c4\u306f\u30ec\u30b3\u30fc\u30c9\u30b3\u30f3\u30c6\u30ca\u30fc\u306b\u8ffd\u52a0\u3067\u304d\u307e\u305b\u3093\u3002 \u30ec\u30b3\u30fc\u30c9\u30d5\u30a9\u30eb\u30c0\u3092\u4f7f\u7528\u3057\u3066\u30b3\u30f3\u30c6\u30f3\u30c4\u3092\u6574\u7406\u4fdd\u7ba1\u3057\u307e\u3059\u3002 +rm.service.error-add-content-container=\u30b3\u30f3\u30c6\u30f3\u30c4\u306f\u30ec\u30b3\u30fc\u30c9\u30b3\u30f3\u30c6\u30ca\u30fc\u306b\u8ffd\u52a0\u3067\u304d\u307e\u305b\u3093\u3002\u30ec\u30b3\u30fc\u30c9\u30d5\u30a9\u30eb\u30c0\u3092\u4f7f\u7528\u3057\u3066\u30b3\u30f3\u30c6\u30f3\u30c4\u3092\u6574\u7406\u4fdd\u7ba1\u3057\u307e\u3059\u3002 rm.service.update-disposition-action-def=\u66f4\u65b0\u304c\u516c\u958b\u3055\u308c\u3066\u3044\u308b\u306e\u3067\u3001\u5ec3\u68c4\u30a2\u30af\u30b7\u30e7\u30f3\u306e\u5b9a\u7fa9\u3092\u66f4\u65b0\u3067\u304d\u307e\u305b\u3093\u3002 -rm.service.set-id=\u30aa\u30d6\u30b8\u30a7\u30af\u30c8 {0} \u306e ID \u30d7\u30ed\u30d1\u30c6\u30a3\u5024\u306f\u8aad\u307f\u53d6\u308a\u5c02\u7528\u306a\u306e\u3067\u3001\u8a2d\u5b9a\u3067\u304d\u307e\u305b\u3093\u3002 -rm.service.path-node=\u30d1\u30b9\u3092\u53d6\u5f97\u3067\u304d\u307e\u305b\u3093\u3002 (nodeRef={0}) +rm.service.set-id=\u30aa\u30d6\u30b8\u30a7\u30af\u30c8 {0} \u306eID\u30d7\u30ed\u30d1\u30c6\u30a3\u5024\u306f\u8aad\u307f\u53d6\u308a\u5c02\u7528\u306a\u306e\u3067\u3001\u8a2d\u5b9a\u3067\u304d\u307e\u305b\u3093\u3002 +rm.service.path-node=\u30d1\u30b9\u3092\u53d6\u5f97\u3067\u304d\u307e\u305b\u3093\u3002(nodeRef={0}) rm.service.invalid-rm-node=\u30a2\u30b9\u30da\u30af\u30c8 {0} \u304c\u5b58\u5728\u3057\u306a\u3044\u305f\u3081\u3001\u7121\u52b9\u306a\u30ec\u30b3\u30fc\u30c9\u7ba1\u7406\u30ce\u30fc\u30c9\u3067\u3059\u3002 rm.service.no-root=\u30ec\u30b3\u30fc\u30c9\u7ba1\u7406\u30eb\u30fc\u30c8\u304c\u898b\u3064\u304b\u308a\u307e\u305b\u3093\u3002 rm.service.dup-root=\u3053\u306e\u968e\u5c64\u306b\u3059\u3067\u306b\u30ec\u30b3\u30fc\u30c9\u7ba1\u7406\u30eb\u30fc\u30c8\u304c\u5b58\u5728\u3059\u308b\u305f\u3081\u3001\u4f5c\u6210\u3067\u304d\u307e\u305b\u3093\u3002 -rm.service.root-type=\u30bf\u30a4\u30d7 {0} \u306f\u3001rm:recordsManagementRootContainer \u306e\u30b5\u30d6\u30bf\u30a4\u30d7\u3067\u306f\u306a\u3044\u305f\u3081\u3001\u30ec\u30b3\u30fc\u30c9\u7ba1\u7406\u30eb\u30fc\u30c8\u3092\u4f5c\u6210\u3067\u304d\u307e\u305b\u3093\u3002 +rm.service.root-type=\u30bf\u30a4\u30d7 {0} \u306f\u3001rm:recordsManagementRootContainer\u306e\u30b5\u30d6\u30bf\u30a4\u30d7\u3067\u306f\u306a\u3044\u305f\u3081\u3001\u30ec\u30b3\u30fc\u30c9\u7ba1\u7406\u30eb\u30fc\u30c8\u3092\u4f5c\u6210\u3067\u304d\u307e\u305b\u3093\u3002 rm.service.container-parent-type=\u89aa\u304c rm:recordsManagement (parentType={0}) \u306e\u30b5\u30d6\u30bf\u30a4\u30d7\u3067\u306f\u306a\u304b\u3063\u305f\u305f\u3081\u3001\u30ec\u30b3\u30fc\u30c9\u7ba1\u7406\u30b3\u30f3\u30c6\u30ca\u30fc\u3092\u4f5c\u6210\u3067\u304d\u307e\u305b\u3093\u3002 rm.service.container-type=\u30bf\u30a4\u30d7 {0} \u306f\u3001rm:recordsManagementContainer \u306e\u30b5\u30d6\u30bf\u30a4\u30d7\u3067\u306f\u306a\u3044\u305f\u3081\u3001\u30ec\u30b3\u30fc\u30c9\u7ba1\u7406\u30b3\u30f3\u30c6\u30ca\u30fc\u3092\u4f5c\u6210\u3067\u304d\u307e\u305b\u3093\u3002 rm.service.container-expected=rm:recordsManagementContainer \u30ce\u30fc\u30c9\u3078\u306e\u30ce\u30fc\u30c9\u53c2\u7167\u304c\u4e88\u60f3\u3055\u308c\u307e\u3059\u3002 rm.service.record-folder-expected=rm:recordFolder \u30ce\u30fc\u30c9\u3078\u306e\u30ce\u30fc\u30c9\u53c2\u7167\u304c\u4e88\u60f3\u3055\u308c\u307e\u3059\u3002 rm.service.parent-record-folder-root=\u89aa\u304c\u30ec\u30b3\u30fc\u30c9\u7ba1\u7406\u30eb\u30fc\u30c8\u306a\u306e\u3067\u3001\u30ec\u30b3\u30fc\u30c9\u30d5\u30a9\u30eb\u30c0\u3092\u4f5c\u6210\u3067\u304d\u307e\u305b\u3093\u3002 -rm.service.parent-record-folder-type=\u89aa\u304c rm:recordsManagementContainer \u306e\u30b5\u30d6\u30bf\u30a4\u30d7\u3067\u306f\u306a\u304b\u3063\u305f\u305f\u3081\u3001\u30ec\u30b3\u30fc\u30c9\u30d5\u30a9\u30eb\u30c0\u3092\u4f5c\u6210\u3067\u304d\u307e\u305b\u3093\u3002 (parentType={0}) -rm.service.record-folder-type=\u6307\u5b9a\u3055\u308c\u305f\u30bf\u30a4\u30d7\u304c rm:recordFolder \u306e\u30b5\u30d6\u30bf\u30a4\u30d7\u3067\u306f\u306a\u3044\u305f\u3081\u3001\u30ec\u30b3\u30fc\u30c9\u30d5\u30a9\u30eb\u30c0\u3092\u4f5c\u6210\u3067\u304d\u307e\u305b\u3093\u3002 (type={0}) +rm.service.parent-record-folder-type=\u89aa\u304c rm:recordsManagementContainer \u306e\u30b5\u30d6\u30bf\u30a4\u30d7\u3067\u306f\u306a\u304b\u3063\u305f\u305f\u3081\u3001\u30ec\u30b3\u30fc\u30c9\u30d5\u30a9\u30eb\u30c0\u3092\u4f5c\u6210\u3067\u304d\u307e\u305b\u3093\u3002(parentType={0}) +rm.service.record-folder-type=\u6307\u5b9a\u3055\u308c\u305f\u30bf\u30a4\u30d7\u304c rm:recordFolder \u306e\u30b5\u30d6\u30bf\u30a4\u30d7\u3067\u306f\u306a\u3044\u305f\u3081\u3001\u30ec\u30b3\u30fc\u30c9\u30d5\u30a9\u30eb\u30c0\u3092\u4f5c\u6210\u3067\u304d\u307e\u305b\u3093\u3002(type={0}) rm.service.not-record=\u30ce\u30fc\u30c9 {0} \u306f\u30ec\u30b3\u30fc\u30c9\u3067\u306f\u3042\u308a\u307e\u305b\u3093\u3002 -rm.service.vital-def-missing=\u30d0\u30a4\u30bf\u30eb\u30ec\u30b3\u30fc\u30c9\u306e\u5b9a\u7fa9\u30a2\u30b9\u30da\u30af\u30c8\u304c\u30ce\u30fc\u30c9\u306b\u5b58\u5728\u3057\u307e\u305b\u3093\u3002 (nodeRef={0}) +rm.service.vital-def-missing=\u30d0\u30a4\u30bf\u30eb\u30ec\u30b3\u30fc\u30c9\u306e\u5b9a\u7fa9\u30a2\u30b9\u30da\u30af\u30c8\u304c\u30ce\u30fc\u30c9\u306b\u5b58\u5728\u3057\u307e\u305b\u3093\u3002(nodeRef={0}) rm.service.close-record-folder-not-folder=\u30ec\u30b3\u30fc\u30c9\u30d5\u30a9\u30eb\u30c0\u3092\u9589\u3058\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u305b\u3093\u3067\u3057\u305f\u3002\u30ec\u30b3\u30fc\u30c9\u30d5\u30a9\u30eb\u30c0\u3068\u3057\u3066\u5b9a\u7fa9\u3055\u308c\u3066\u3044\u306a\u3044\u305f\u3081\u3067\u3059\u3002(nodeRef={0}) -rm.service.node-has-aspect=\u30ce\u30fc\u30c9 {0} \u306b\u306f\u3059\u3067\u306b\u30a2\u30b9\u30da\u30af\u30c8 {1} \u304c\u3042\u308a\u307e\u3059\u3002 -rm.service.final-version=\u6700\u7d42\u7248 -rm.service.final-version-description=\u30a2\u30fc\u30ab\u30a4\u30d6\u3055\u308c\u305f\u30ec\u30b3\u30fc\u30c9\u306e\u6700\u7d42\u30d0\u30fc\u30b8\u30e7\u30f3 \ No newline at end of file +rm.service.node-has-aspect=\u30ce\u30fc\u30c9{0}\u306b\u306f\u3059\u3067\u306b\u30a2\u30b9\u30da\u30af\u30c8{1}\u304c\u3042\u308a\u307e\u3059\u3002 \ No newline at end of file diff --git a/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/records-management-service_nb.properties b/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/records-management-service_nb.properties deleted file mode 100644 index f05c0cb507..0000000000 --- a/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/records-management-service_nb.properties +++ /dev/null @@ -1,21 +0,0 @@ -rm.service.error-add-content-container=Innhold kan ikke legges til en oppf\u00f8ringsbeholder. Bruk oppf\u00f8ringsmapper for \u00e5 arkivere innhold. -rm.service.update-disposition-action-def=Definisjonen til disposisjonshandlingen kan ikke oppdateres fordi en oppdatering er publisert. -rm.service.set-id=ID-egenskapsverdien til elementet {0} kan kun leses og ikke stilles inn. -rm.service.path-node=Klarer ikke \u00e5 f\u00e5 banen. (nodeRef={0}) -rm.service.invalid-rm-node=Ugyldig oppf\u00f8ringsh\u00e5ndteringsnode fordi aspektet {0} finnes ikke. -rm.service.no-root=Finner ikke filplanen. -rm.service.dup-root=Kan ikke opprette filplanen fordi det finnes allerede en plan i dette hierarkiet. -rm.service.root-type=Kan ikke opprette filplanen fordi typen {0} ikke er en subtype av rm:recordsManagementRootContainer. -rm.service.container-parent-type=Kan ikke opprette filplanbeholderen fordi overordnede ikke var en subtype av rm:recordsManagement (parentType={0}) -rm.service.container-type=Kan ikke opprette filplanbeholder fordi typen {0} ikke er en subtype av rm:recordsManagementContainer. -rm.service.container-expected=Nodereferanse til en rm:recordsManagementContainer-node utl\u00f8pt. -rm.service.record-folder-expected=Nodereferanse til en rm:recordFolder-node utl\u00f8pt. -rm.service.parent-record-folder-root=Kan ikke opprette en oppf\u00f8ringsmappe fordi den overordnede er en filplan. -rm.service.parent-record-folder-type=Kan ikke opprette en oppf\u00f8ringsmappe fordi den overordnede ikke er en subtype av rm:recordsManagementContainer. (parentType={0}) -rm.service.record-folder-type=Kan ikke opprette oppf\u00f8ringsmappe for den oppgitte typen ikke er en subtype av rm:recordFolder. (type={0}) -rm.service.not-record=Noden {0} er ikke en oppf\u00f8ring. -rm.service.vital-def-missing=Aspektet ved definisjonen til sv\u00e6rt viktige oppf\u00f8ringer finnes ikke p\u00e5 noden. (nodeRef={0}) -rm.service.close-record-folder-not-folder=Oppf\u00f8ringsmappen kan ikke lukkes fordi den ikke er definert som en oppf\u00f8ringsmappe.(nodeRef={0}) -rm.service.node-has-aspect=Noden {0} har allerede aspektet {1}. -rm.service.final-version=Endelig -rm.service.final-version-description=Den endelig arkiverte oppf\u00f8ringsversjonen \ No newline at end of file diff --git a/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/records-management-service_nl.properties b/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/records-management-service_nl.properties index de6709175f..392e55823e 100755 --- a/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/records-management-service_nl.properties +++ b/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/records-management-service_nl.properties @@ -1,5 +1,5 @@ rm.service.error-add-content-container=Content kan niet aan een recordcontainer worden toegevoegd. Gebruik archiefmappen voor archiveren van content. -rm.service.update-disposition-action-def=De definitie van de beschikkingsactie kan niet worden bijgewerkt omdat er een update wordt gepubliceerd. +rm.service.update-disposition-action-def=De definitie van de archiveringsactie kan niet worden bijgewerkt omdat er een update wordt gepubliceerd. rm.service.set-id=De waarde voor de identificatie-eigenschap van het object {0} is alleen-lezen en kan dus niet worden ingesteld. rm.service.path-node=Kan pad niet ophalen. (nodeRef={0}) rm.service.invalid-rm-node=Ongeldige node voor Record Management omdat aspect {0} niet aanwezig is. @@ -16,6 +16,4 @@ rm.service.record-folder-type=Kan geen archiefmap maken omdat het geleverde type rm.service.not-record=De node {0} is geen record. rm.service.vital-def-missing=Definitie-aspect van vitale record is niet aanwezig op node. (nodeRef={0}) rm.service.close-record-folder-not-folder=De archiefmap kan niet worden gesloten omdat hij niet als een archiefmap is gedefinieerd.(nodeRef={0}) -rm.service.node-has-aspect=De node {0} heeft al het aspect {1}. -rm.service.final-version=Definitief -rm.service.final-version-description=De definitieve gearchiveerde recordversie \ No newline at end of file +rm.service.node-has-aspect=De node {0} heeft al het aspect {1}. \ No newline at end of file diff --git a/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/records-management-service_pt_BR.properties b/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/records-management-service_pt_BR.properties index 346698cd23..7c90aaa8ca 100644 --- a/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/records-management-service_pt_BR.properties +++ b/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/records-management-service_pt_BR.properties @@ -16,6 +16,4 @@ rm.service.record-folder-type=N\u00e3o \u00e9 poss\u00edvel criar uma pasta de d rm.service.not-record=O n\u00f3 {0} n\u00e3o \u00e9 um documento arquiv\u00edstico. rm.service.vital-def-missing=O aspecto de defini\u00e7\u00e3o do documento arquiv\u00edstico vital n\u00e3o est\u00e1 presente no n\u00f3. (nodeRef={0}) rm.service.close-record-folder-not-folder=N\u00e3o foi poss\u00edvel fechar a pasta de documento arquiv\u00edstico porque ela n\u00e3o est\u00e1 definida como uma pasta de documento arquiv\u00edstico.(nodeRef={0}) -rm.service.node-has-aspect=O n\u00f3 {0} j\u00e1 tem o aspecto {1}. -rm.service.final-version=Final -rm.service.final-version-description=A vers\u00e3o do documento arquiv\u00edstico arquivado final \ No newline at end of file +rm.service.node-has-aspect=O n\u00f3 {0} j\u00e1 tem o aspecto {1}. \ No newline at end of file diff --git a/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/records-management-service_ru.properties b/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/records-management-service_ru.properties index a242fa7f9c..f0e37f89af 100644 --- a/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/records-management-service_ru.properties +++ b/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/records-management-service_ru.properties @@ -16,6 +16,4 @@ rm.service.record-folder-type=\u041d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u rm.service.not-record=\u041e\u0431\u044a\u0435\u043a\u0442 {0} \u043d\u0435 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0437\u0430\u043f\u0438\u0441\u044c\u044e. rm.service.vital-def-missing=\u0414\u043b\u044f \u043e\u0431\u044a\u0435\u043a\u0442\u0430 \u043d\u0435 \u0443\u043a\u0430\u0437\u0430\u043d \u0430\u0441\u043f\u0435\u043a\u0442 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u043a\u043b\u044e\u0447\u0435\u0432\u043e\u0439 \u0437\u0430\u043f\u0438\u0441\u0438. (nodeRef={0}) rm.service.close-record-folder-not-folder=\u041d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0437\u0430\u043a\u0440\u044b\u0442\u044c \u043f\u0430\u043f\u043a\u0443 \u0437\u0430\u043f\u0438\u0441\u0435\u0439: \u043f\u0430\u043f\u043a\u0430 \u043d\u0435 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0430 \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043f\u0430\u043f\u043a\u0438 \u0437\u0430\u043f\u0438\u0441\u0435\u0439. (nodeRef={0}) -rm.service.node-has-aspect=\u0414\u043b\u044f \u043e\u0431\u044a\u0435\u043a\u0442\u0430 {0} \u0443\u0436\u0435 \u0443\u043a\u0430\u0437\u0430\u043d \u0430\u0441\u043f\u0435\u043a\u0442 {1}. -rm.service.final-version=\u041e\u043a\u043e\u043d\u0447\u0430\u0442\u0435\u043b\u044c\u043d\u0430\u044f -rm.service.final-version-description=\u041e\u043a\u043e\u043d\u0447\u0430\u0442\u0435\u043b\u044c\u043d\u0430\u044f \u0432\u0435\u0440\u0441\u0438\u044f \u0430\u0440\u0445\u0438\u0432\u043d\u043e\u0439 \u0437\u0430\u043f\u0438\u0441\u0438 \ No newline at end of file +rm.service.node-has-aspect=\u0414\u043b\u044f \u043e\u0431\u044a\u0435\u043a\u0442\u0430 {0} \u0443\u0436\u0435 \u0443\u043a\u0430\u0437\u0430\u043d \u0430\u0441\u043f\u0435\u043a\u0442 {1}. \ No newline at end of file diff --git a/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/records-management-service_zh_CN.properties b/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/records-management-service_zh_CN.properties index 3bd7fcb8c2..021dd99535 100644 --- a/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/records-management-service_zh_CN.properties +++ b/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/records-management-service_zh_CN.properties @@ -16,6 +16,4 @@ rm.service.record-folder-type=\u65e0\u6cd5\u521b\u5efa\u8bb0\u5f55\u6587\u4ef6\u rm.service.not-record=\u8282\u70b9 {0} \u5e76\u975e\u8bb0\u5f55\u3002 rm.service.vital-def-missing=\u8282\u70b9\u4e0a\u4e0d\u5b58\u5728\u6838\u5fc3\u8bb0\u5f55\u5b9a\u4e49\u5207\u9762\u3002(nodeRef={0}) rm.service.close-record-folder-not-folder=\u65e0\u6cd5\u5173\u95ed\u8bb0\u5f55\u6587\u4ef6\u5939\uff0c\u56e0\u4e3a\u5e76\u672a\u5c06\u5176\u5b9a\u4e49\u4e3a\u8bb0\u5f55\u6587\u4ef6\u5939\u3002(nodeRef={0}) -rm.service.node-has-aspect=\u8282\u70b9 {0} \u5df2\u6709\u5207\u9762 {1}\u3002 -rm.service.final-version=\u6700\u7ec8 -rm.service.final-version-description=\u6700\u7ec8\u5b58\u6863\u7684\u8bb0\u5f55\u7248\u672c \ No newline at end of file +rm.service.node-has-aspect=\u8282\u70b9 {0} \u5df2\u6709\u5207\u9762 {1}\u3002 \ No newline at end of file diff --git a/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/records-model_nb.properties b/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/records-model_nb.properties deleted file mode 100644 index 09ec7810c3..0000000000 --- a/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/records-model_nb.properties +++ /dev/null @@ -1,265 +0,0 @@ -rma_recordsmanagement.description=Oppf\u00f8ringsh\u00e5ndtering av innholdsmodell - -rma_recordsmanagement.type.rma_rmsite.title=Sted til oppf\u00f8ringsh\u00e5ndtering -rma_recordsmanagement.type.rma_rmsite.description=Spesialisert omr\u00e5de til oppf\u00f8ringsh\u00e5ndtering - -rma_recordsmanagement.type.rma_caveatConfig.title=Varselskonfigurasjon -rma_recordsmanagement.type.rma_caveatConfig.decription=Varselskonfigurasjon - -rma_recordsmanagement.type.rma_emailConfig.title=E-postkonfigurasjon -rma_recordsmanagement.type.rma_emailConfig.decription=E-postkonfigurasjon - -rma_recordsmanagement.type.rma_recordsManagementContainer.title=Oppf\u00f8ringsh\u00e5ndteringsbeholder -rma_recordsmanagement.type.rma_recordsManagementContainer.decription=Oppf\u00f8ringsh\u00e5ndteringsbeholder - -rma_recordsmanagement.type.rma_recordsManagementRootContainer.title=Filplanbeholder -rma_recordsmanagement.type.rma_recordsManagementRootContainer.decription=Filplanbeholder - -rma_recordsmanagement.type.rma_dispositionSchedule.title=Disposisjonsplan -rma_recordsmanagement.type.rma_dispositionSchedule.decription=Disposisjonsplan - -rma_recordsmanagement.property.rma_dispositionAuthority.title=Disposisjonsrett -rma_recordsmanagement.property.rma_dispositionAuthority.decription=Disposisjonsrett - -rma_recordsmanagement.property.rma_dispositionInstructions.title=Disposisjonsinstruksjoner -rma_recordsmanagement.property.rma_dispositionInstructions.decription=Disposisjonsinstruksjoner - -rma_recordsmanagement.property.rma_recordLevelDisposition.title=Disposisjonsniv\u00e5 ved oppf\u00f8ringer -rma_recordsmanagement.property.rma_recordLevelDisposition.decription=Disposisjonsniv\u00e5 ved oppf\u00f8ringer - -rma_recordsmanagement.association.rma_dispositionActionDefinitions.title=Disposisjonshandlinger -rma_recordsmanagement.association.rma_dispositionActionDefinitions.decription=Disposisjonshandlinger - -rma_recordsmanagement.type.rma_dispositionActionDefinition.title=Definisjon av disposisjonshandling -rma_recordsmanagement.type.rma_dispositionActionDefinition.decription=Definisjon av disposisjonshandling -rma_recordsmanagement.property.rma_dispositionActionName.title=Navn p\u00e5 disposisjonshandling -rma_recordsmanagement.property.rma_dispositionActionName.decription=Navn p\u00e5 disposisjonshandling -rma_recordsmanagement.property.rma_dispositionDescription.title=Disposisjonsbeskrivelse -rma_recordsmanagement.property.rma_dispositionDescription.decription=Disposisjonsbeskrivelse -rma_recordsmanagement.property.rma_dispositionLocation.title=Disposisjonsplassering -rma_recordsmanagement.property.rma_dispositionLocation.decription=Disposisjonsplassering -rma_recordsmanagement.property.rma_dispositionPeriod.title=Disposisjonstid -rma_recordsmanagement.property.rma_dispositionPeriod.decription=Disposisjonstid -rma_recordsmanagement.property.rma_dispositionPeriodProperty.title=Egenskaper til disposisjonstiden -rma_recordsmanagement.property.rma_dispositionPeriodProperty.decription=Egenskaper til disposisjonstiden -rma_recordsmanagement.property.rma_dispositionEvent.title=Disposisjonshendelse -rma_recordsmanagement.property.rma_dispositionEvent.decription=Disposisjonshendelse -rma_recordsmanagement.property.rma_dispositionEventCombination.title=Kombinasjon av disposisjonshendelse -rma_recordsmanagement.property.rma_dispositionEventCombination.decription=Kombinasjon av disposisjonshendelse - -rma_recordsmanagement.type.rma_recordFolder.title=Oppf\u00f8ringsmappe -rma_recordsmanagement.type.rma_recordFolder.decription=Oppf\u00f8ringsmappe -rma_recordsmanagement.property.rma_isClosed.title=Oppf\u00f8ring -rma_recordsmanagement.property.rma_isClosed.decription=Oppf\u00f8ring - -rma_recordsmanagement.type.rma_recordCategory.title=Oppf\u00f8ringskategori -rma_recordsmanagement.type.rma_recordCategory.decription=Oppf\u00f8ringskategori - -rma_recordsmanagement.type.rma_nonElectronicDocument.title=Ikke-elektronisk dokument -rma_recordsmanagement.type.rma_nonElectronicDocument.decription=Ikke-elektronisk dokument -rma_recordsmanagement.property.rma_physicalSize.title=Fysisk st\u00f8rrelse -rma_recordsmanagement.property.rma_physicalSize.decription=St\u00f8rrelsen p\u00e5 dokumentet m\u00e5lt i line\u00e6re meter. -rma_recordsmanagement.property.rma_numberOfCopies.title=Antall kopier -rma_recordsmanagement.property.rma_numberOfCopies.description=Antall kopier av dokumentet. -rma_recordsmanagement.property.rma_storageLocation.title=Lagringssted -rma_recordsmanagement.property.rma_storageLocation.decription=Det fysiske lagringsstedet til oppf\u00f8ringen. -rma_recordsmanagement.property.rma_shelf.title=Hylle -rma_recordsmanagement.property.rma_shelf.decription=Hyllen som oppf\u00f8ringen befinner seg p\u00e5. -rma_recordsmanagement.property.rma_box.title=Eske -rma_recordsmanagement.property.rma_box.description=Esken som oppf\u00f8ringen befinner seg i. -rma_recordsmanagement.property.rma_file.title=Fil -rma_recordsmanagement.property.rma_file.decription=Filen som oppf\u00f8ringen befinner seg i. - -rma_recordsmanagement.type.rma_dispositionAction.title=Disposisjonshandling -rma_recordsmanagement.type.rma_dispositionAction.decription=Disposisjonshandling -rma_recordsmanagement.property.rma_dispositionActionId.title=ID til disposisjonshandling -rma_recordsmanagement.property.rma_dispositionActionId.decription=ID til disposisjonshandling -rma_recordsmanagement.property.rma_dispositionAction.title=Disposisjonshandling -rma_recordsmanagement.property.rma_dispositionAction.decription=Disposisjonshandling -rma_recordsmanagement.property.rma_dispositionAsOf.title=Disposisjonshandling -rma_recordsmanagement.property.rma_dispositionAsOf.decription=Disposisjonshandling -rma_recordsmanagement.property.rma_dispositionEventsEligible.title=Kvalifiserte disposisjonshendelser -rma_recordsmanagement.property.rma_dispositionEventsEligible.decription=Kvalifiserte disposisjonshendelser -rma_recordsmanagement.property.rma_dispositionActionStartedAt.title=Disposisjonshandling startet den -rma_recordsmanagement.property.rma_dispositionActionStartedAt.decription=Disposisjonshandling startet den -rma_recordsmanagement.property.rma_dispositionActionStartedBy.title=Disposisjonshandling startet av -rma_recordsmanagement.property.rma_dispositionActionStartedBy.decription=Disposisjonshandling startet av -rma_recordsmanagement.property.rma_dispositionActionCompletedAt.title=Disposisjonshandling fullf\u00f8rt p\u00e5 -rma_recordsmanagement.property.rma_dispositionActionCompletedAt.decription=Disposisjonshandling fullf\u00f8rt p\u00e5 -rma_recordsmanagement.property.rma_dispositionActionCompletedBy.title=Disposisjonshandling fullf\u00f8rt av -rma_recordsmanagement.property.rma_dispositionActionCompletedBy.decription=Disposisjonshandling fullf\u00f8rt av -rma_recordsmanagement.association.rma_eventExecutions.title=Utf\u00f8rte hendelser -rma_recordsmanagement.association.rma_eventExecutions.decription=Utf\u00f8rte hendelser - -rma_recordsmanagement.type.rma_eventExecution.title=Utf\u00f8relse av hendelse -rma_recordsmanagement.type.rma_eventExecution.decription=Utf\u00f8relse av hendelse -rma_recordsmanagement.property.rma_eventExecutionName.title=Hendelsenavn -rma_recordsmanagement.property.rma_eventExecutionName.decription=Hendelsenavn -rma_recordsmanagement.property.rma_eventExecutionAutomatic.title=Automatisk hendelse -rma_recordsmanagement.property.rma_eventExecutionAutomatic.decription=Automatisk hendelse -rma_recordsmanagement.property.rma_eventExecutionComplete.title=Fullf\u00f8rt hendelse -rma_recordsmanagement.property.rma_eventExecutionComplete.decription=Fullf\u00f8rt hendelse -rma_recordsmanagement.property.rma_eventExecutionCompletedBy.title=Hendelse fullf\u00f8rt av -rma_recordsmanagement.property.rma_eventExecutionCompletedBy.decription=Hendelse fullf\u00f8rt av -rma_recordsmanagement.property.rma_eventExecutionCompletedAt.title=Hendelse fullf\u00f8rt den -rma_recordsmanagement.property.rma_eventExecutionCompletedAt.decription=Hendelse fullf\u00f8rt den - -rma_recordsmanagement.type.rma_hold.title=Hold -rma_recordsmanagement.type.rma_hold.decription=Hold -rma_recordsmanagement.property.rma_holdReason.title=Grunn til holdet -rma_recordsmanagement.property.rma_holdReason.decription=Grunn til holdet -rma_recordsmanagement.association.rma_frozenRecords.title=Oppf\u00f8ringer p\u00e5 hold -rma_recordsmanagement.association.rma_frozenRecords.decription=Oppf\u00f8ringer p\u00e5 hold - -rma_recordsmanagement.type.rma_transfer.title=Overf\u00f8r -rma_recordsmanagement.type.rma_transfer.decription=Overf\u00f8r -rma_recordsmanagement.property.rma_transferAccessionIndicator.title=Overf\u00f8r tilgangsindikator -rma_recordsmanagement.property.rma_transferAccessionIndicator.decription=Overf\u00f8r tilgangsindikator -rma_recordsmanagement.property.rma_transferPDFIndicator.title=Overf\u00f8r PDF-indikator -rma_recordsmanagement.property.rma_transferPDFIndicator.decription=Overf\u00f8r PDF-indikator -rma_recordsmanagement.property.rma_transferLocation.title=Overf\u00f8r PDF -rma_recordsmanagement.property.rma_transferLocation.decription=Overf\u00f8r PDF -rma_recordsmanagement.association.rma_transferred.title=Overf\u00f8rt -rma_recordsmanagement.association.rma_transferred.decription=Overf\u00f8rt - -rma_recordsmanagement.aspect.rma_filePlanComponent.title=Filplandel -rma_recordsmanagement.aspect.rma_filePlanComponent.decription=Filplandel -rma_recordsmanagement.property.rma_rootNodeRef.title=Rotnode -rma_recordsmanagement.property.rma_rootNodeRef.decription=Rotnode - -rma_recordsmanagement.aspect.rma_recordsManagementRoot.title=Filplan -rma_recordsmanagement.aspect.rma_recordsManagementRoot.decription=Filplan -rma_recordsmanagement.association.rma_holds.title=Hold -rma_recordsmanagement.association.rma_holds.decription=Hold -rma_recordsmanagement.association.rma_transfers.title=Overf\u00f8ringer -rma_recordsmanagement.association.rma_transfers.decription=Overf\u00f8ringer - -rma_recordsmanagement.aspect.rma_declaredRecord.title=Fullf\u00f8rt oppf\u00f8ring -rma_recordsmanagement.aspect.rma_declaredRecord.decription=Fullf\u00f8rt oppf\u00f8ring -rma_recordsmanagement.property.rma_declaredAt.title=Dato fullf\u00f8rt -rma_recordsmanagement.property.rma_declaredAt.decription=Dato fullf\u00f8rt -rma_recordsmanagement.property.rma_declaredBy.title=Fullf\u00f8rt av -rma_recordsmanagement.property.rma_declaredBy.decription=Fullf\u00f8rt av - -rma_recordsmanagement.aspect.rma_recordComponentIdentifier.title=Del-ID til oppf\u00f8ring -rma_recordsmanagement.aspect.rma_recordComponentIdentifier.decription=Del-ID til oppf\u00f8ring -rma_recordsmanagement.property.rma_identifier.title=Identifikator -rma_recordsmanagement.property.rma_identifier.decription=Unik oppf\u00f8rings-ID -rma_recordsmanagement.property.rma_dbUniquenessId.title=Unikt ved database -rma_recordsmanagement.property.rma_dbUniquenessId.decription=Unikt ved database - -rma_recordsmanagement.aspect.rma_vitalRecordDefinition.title=Sv\u00e6rt viktig oppf\u00f8ringsdefinisjon -rma_recordsmanagement.aspect.rma_vitalRecordDefinition.decription=Sv\u00e6rt viktig oppf\u00f8ringsdefinisjon - -rma_recordsmanagement.property.rma_reviewPeriod.title=Gjennomgangsperiode -rma_recordsmanagement.property.rma_reviewPeriod.decription=Gjennomgangsperiode -rma_recordsmanagement.property.rma_vitalRecordIndicator.title=Sv\u00e6rt viktig oppf\u00f8ringsindikator -rma_recordsmanagement.property.rma_vitalRecordIndicator.decription=Sv\u00e6rt viktig oppf\u00f8ringsindikator - -rma_recordsmanagement.aspect.rma_record.title=Oppf\u00f8ring -rma_recordsmanagement.aspect.rma_record.decription=Oppf\u00f8ring -rma_recordsmanagement.property.rma_dateFiled.title=Dato registrert -rma_recordsmanagement.property.rma_dateFiled.decription=Dato registrert -rma_recordsmanagement.property.rma_origionalName=Opprinnelig navn - -rma_recordsmanagement.aspect.rma_recordMetaData.title=Registrer metadata -rma_recordsmanagement.aspect.rma_recordMetaData.description=Mark\u00f8raspekt til registrerte metadata - -rma_recordsmanagement.aspect.rma_commonRecordDetails.title=Felles oppf\u00f8ringsinformasjon -rma_recordsmanagement.aspect.rma_commonRecordDetails.description=Metadata som gjelder alle typer oppf\u00f8ringer -rma_recordsmanagement.property.rma_location.title=Sted -rma_recordsmanagement.property.rma_location.decription=Sted - -rma_recordsmanagement.aspect.rma_vitalRecord.title=Sv\u00e6rt viktig oppf\u00f8ring -rma_recordsmanagement.aspect.rma_vitalRecord.decription=Sv\u00e6rt viktig oppf\u00f8ring -rma_recordsmanagement.property.rma_reviewAsOf.title=Neste gjennomgang -rma_recordsmanagement.property.rma_reviewAsOf.decription=Neste gjennomgang -rma_recordsmanagement.property.rma_notificationIssued.title=Indikerer at en melding om at denne oppf\u00f8ringen skal gjennomg\u00e5s, er blitt utstedt -rma_recordsmanagement.property.rma_notificationIssued.decription=Indikerer at en melding om at denne oppf\u00f8ringen skal gjennomg\u00e5s, er blitt utstedt - -rma_recordsmanagement.aspect.rma_scheduled.title=Planlagt -rma_recordsmanagement.aspect.rma_scheduled.decription=Planlagt -rma_recordsmanagement.association.rma_dispositionSchedule.title=Disposisjonsplan -rma_recordsmanagement.association.rma_dispositionSchedule.decription=Disposisjonsplan - -rma_recordsmanagement.aspect.rma_dispositionLifecycle.title=Livssyklus ved disposisjon -rma_recordsmanagement.aspect.rma_dispositionLifecycle.decription=Livssyklus ved disposisjon -rma_recordsmanagement.association.rma_nextDispositionAction.title=Neste disposisjonshandling -rma_recordsmanagement.association.rma_nextDispositionAction.decription=Neste disposisjonshandling -rma_recordsmanagement.association.rma_dispositionActionHistory.title=Historikk til disposisjonshandlinger -rma_recordsmanagement.association.rma_dispositionActionHistory.decription=Historikk til disposisjonshandlinger - -rma_recordsmanagement.aspect.rma_cutOff.title=Cut off -rma_recordsmanagement.aspect.rma_cutOff.decription=Cut off -rma_recordsmanagement.property.rma_cutOffDate.title=Cut off-dato -rma_recordsmanagement.property.rma_cutOffDate.decription=Cut off-dato - -rma_recordsmanagement.aspect.rma_transferred.title=Overf\u00f8rt -rma_recordsmanagement.aspect.rma_transferred.decription=Overf\u00f8rt - -rma_recordsmanagement.aspect.rma_ascended.title=Stigende -rma_recordsmanagement.aspect.rma_ascended.decription=Stigende - -rma_recordsmanagement.aspect.rma_frozen.title=P\u00e5 hold -rma_recordsmanagement.aspect.rma_frozen.decription=P\u00e5 hold -rma_recordsmanagement.property.rma_frozenAt.title=Holdes ved -rma_recordsmanagement.property.rma_frozenAt.decription=Holdes ved -rma_recordsmanagement.property.rma_frozenBy.title=Holdes av -rma_recordsmanagement.property.rma_frozenBy.decription=Holdes av - -rma_recordsmanagement.aspect.rma_caveatConfigRoot.title=Varselskonfigurasjonsrot -rma_recordsmanagement.aspect.rma_caveatConfigRoot.decription=Varselskonfigurasjonsrot -rma_recordsmanagement.association.rma_caveatConfigAssoc.title=Varselskonfigurasjon -rma_recordsmanagement.association.rma_caveatConfigAssoc.description=Varselskonfigurasjon - -rma_recordsmanagement.aspect.rma_emailConfigRoot.title=E-postkonfigurasjonsrot -rma_recordsmanagement.aspect.rma_emailConfigRoot.decription=E-postkonfigurasjonsrot -rma_recordsmanagement.association.rma_emailConfigAssoc.title=E-postkonfigurasjon -rma_recordsmanagement.association.rma_emailConfigAssoc.description=E-postkonfigurasjon - -rma_recordsmanagement.aspect.rma_recordSearch.title=Oppf\u00f8ringss\u00f8k -rma_recordsmanagement.aspect.rma_recordSearch.decription=Rullet opp s\u00f8keinformasjonen for \u00e5 st\u00f8tte oppf\u00f8ringsh\u00e5ndteringss\u00f8ket -rma_recordsmanagement.property.rma_recordSearchHasDispositionSchedule.title=Har disposisjonsplan -rma_recordsmanagement.property.rma_recordSearchHasDispositionSchedule.description=Indikerer om elementet er forbundet med disposisjonsplanen -rma_recordsmanagement.property.rma_recordSearchDispositionActionName.title=Navn p\u00e5 disposisjonshandling -rma_recordsmanagement.property.rma_recordSearchDispositionActionName.description=Navnet p\u00e5 neste disposisjonshandling -rma_recordsmanagement.property.rma_recordSearchDispositionActionAsOf.title=Disposisjonshandling til -rma_recordsmanagement.property.rma_recordSearchDispositionActionAsOf.description=Datoen n\u00e5r neste disposisjonshandling blir kvalifisert -rma_recordsmanagement.property.rma_recordSearchDispositionPeriod.title=Disposisjonstid -rma_recordsmanagement.property.rma_recordSearchDispositionPeriod.description=Disposisjonstid -rma_recordsmanagement.property.rma_recordSearchDispositionPeriodExpression.title=Uttrykk av disposisjonstid -rma_recordsmanagement.property.rma_recordSearchDispositionPeriodExpression.description=Uttrykk av disposisjonstid -rma_recordsmanagement.property.rma_recordSearchDispositionEventsEligible.title=Kvalifiserte disposisjonshendelser -rma_recordsmanagement.property.rma_recordSearchDispositionEventsEligible.description=Kvalifiserte disposisjonshendelser -rma_recordsmanagement.property.rma_recordSearchDispositionEvents.title=Disposisjonshendelser -rma_recordsmanagement.property.rma_recordSearchDispositionEvents.description=Disposisjonshendelser -rma_recordsmanagement.property.rma_recordSearchDispositionAuthority.title=Disposisjonsrett -rma_recordsmanagement.property.rma_recordSearchDispositionAuthority.description=Disposisjonsrett -rma_recordsmanagement.property.rma_recordSearchDispositionInstructions.title=Disposisjonsinstruksjoner -rma_recordsmanagement.property.rma_recordSearchDispositionInstructions.description=Disposisjonsinstruksjoner -rma_recordsmanagement.property.rma_recordSearchHoldReason.title=Grunn til holdet -rma_recordsmanagement.property.rma_recordSearchHoldReason.description=Grunn til holdet -rma_recordsmanagement.property.rma_recordSearchVitalRecordReviewPeriod.title=Gjennomgangsperiode til den sv\u00e6rt viktige oppf\u00f8ringen -rma_recordsmanagement.property.rma_recordSearchVitalRecordReviewPeriod.description=Gjennomgangsperiode til den sv\u00e6rt viktige oppf\u00f8ringen -rma_recordsmanagement.property.rma_recordSearchVitalRecordReviewPeriodExpression.title=Uttrykk av gjennomgangsperioden -rma_recordsmanagement.property.rma_recordSearchVitalRecordReviewPeriodExpression.description=Uttrykk av gjennomgangsperioden - -rma_recordsmanagement.aspect.rma_versionedRecord.title=Oppf\u00f8ring med versjon -rma_recordsmanagement.aspect.rma_versionedRecord.decription=Oppf\u00f8ring med versjon - -rma_recordsmanagement.aspect.rma_unpublishedUpdate.title=Upublisert oppdatering -rma_recordsmanagement.aspect.rma_unpublishedUpdate.decription=Upublisert oppdatering -rma_recordsmanagement.property.rma_unpublishedUpdate.title=Upublisert oppdatering -rma_recordsmanagement.property.rma_unpublishedUpdate.description=Indikerer om det finnes en upublisert oppdatering -rma_recordsmanagement.property.rma_updateTo.title=Oppdater til -rma_recordsmanagement.property.rma_updateTo.description=M\u00e5let til oppdateringen -rma_recordsmanagement.property.rma_updatedProperties.title=Oppdaterte egenskaper -rma_recordsmanagement.property.rma_updatedProperties.description=De oppdaterte egenskapene -rma_recordsmanagement.property.rma_publishInProgress.title=Publisering p\u00e5g\u00e5r -rma_recordsmanagement.property.rma_publishInProgress.description=Indikerer om en publisering p\u00e5g\u00e5r for tiden - -rma_recordsmanagement.aspect.dod_ghosted.title=Oppf\u00f8ring kun med metadata -rma_recordsmanagement.aspect.dod_ghosted.description=Oppf\u00f8ring kun med metadata - -listconstraint.rmc_tlList.title=Overf\u00f8ringssteder -listconstraint.rmc_smList.title=Tilleggsmarkeringer \ No newline at end of file diff --git a/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/records-model_ru.properties b/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/records-model_ru.properties index 5831e3cd81..9a323e705d 100644 --- a/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/records-model_ru.properties +++ b/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/records-model_ru.properties @@ -104,12 +104,12 @@ rma_recordsmanagement.property.rma_eventExecutionCompletedBy.decription=\u041f\u rma_recordsmanagement.property.rma_eventExecutionCompletedAt.title=\u0414\u0430\u0442\u0430 \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u044f \u0441\u043e\u0431\u044b\u0442\u0438\u044f rma_recordsmanagement.property.rma_eventExecutionCompletedAt.decription=\u0414\u0430\u0442\u0430 \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u044f \u0441\u043e\u0431\u044b\u0442\u0438\u044f -rma_recordsmanagement.type.rma_hold.title=\u0411\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u0430 -rma_recordsmanagement.type.rma_hold.decription=\u0411\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u0430 -rma_recordsmanagement.property.rma_holdReason.title=\u041f\u0440\u0438\u0447\u0438\u043d\u0430 \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u0438 -rma_recordsmanagement.property.rma_holdReason.decription=\u041f\u0440\u0438\u0447\u0438\u043d\u0430 \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u0438 -rma_recordsmanagement.association.rma_frozenRecords.title=\u0417\u0430\u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u0437\u0430\u043f\u0438\u0441\u0438 -rma_recordsmanagement.association.rma_frozenRecords.decription=\u0417\u0430\u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u0437\u0430\u043f\u0438\u0441\u0438 +rma_recordsmanagement.type.rma_hold.title=\u0411\u043B\u043E\u043A\u0438\u0440\u043E\u0432\u043A\u0430 +rma_recordsmanagement.type.rma_hold.decription=\u0411\u043B\u043E\u043A\u0438\u0440\u043E\u0432\u043A\u0430 +rma_recordsmanagement.property.rma_holdReason.title=\u041f\u0440\u0438\u0447\u0438\u043d\u0430 \u0431\u043B\u043E\u043A\u0438\u0440\u043E\u0432\u043A\u0438 +rma_recordsmanagement.property.rma_holdReason.decription=\u041f\u0440\u0438\u0447\u0438\u043d\u0430 \u0431\u043B\u043E\u043A\u0438\u0440\u043E\u0432\u043A\u0438 +rma_recordsmanagement.association.rma_frozenRecords.title=\u0417\u0430\u0431\u043B\u043E\u043A\u0438\u0440\u043E\u0432\u0430\u043D\u043D\u044B\u0435 \u0437\u0430\u043f\u0438\u0441\u0438 +rma_recordsmanagement.association.rma_frozenRecords.decription=\u0417\u0430\u0431\u043B\u043E\u043A\u0438\u0440\u043E\u0432\u0430\u043D\u043D\u044B\u0435 \u0437\u0430\u043f\u0438\u0441\u0438 rma_recordsmanagement.type.rma_transfer.title=\u041f\u0435\u0440\u0435\u0434\u0430\u0442\u044c rma_recordsmanagement.type.rma_transfer.decription=\u041f\u0435\u0440\u0435\u0434\u0430\u0442\u044c @@ -129,8 +129,8 @@ rma_recordsmanagement.property.rma_rootNodeRef.decription=\u041a\u043e\u0440\u04 rma_recordsmanagement.aspect.rma_recordsManagementRoot.title=\u041a\u043e\u0440\u0435\u043d\u044c \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0437\u0430\u043f\u0438\u0441\u044f\u043c\u0438 rma_recordsmanagement.aspect.rma_recordsManagementRoot.decription=\u041a\u043e\u0440\u0435\u043d\u044c \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0437\u0430\u043f\u0438\u0441\u044f\u043c\u0438 -rma_recordsmanagement.association.rma_holds.title=\u0417\u0430\u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u0437\u0430\u043f\u0438\u0441\u0438 -rma_recordsmanagement.association.rma_holds.decription=\u0417\u0430\u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u0437\u0430\u043f\u0438\u0441\u0438 +rma_recordsmanagement.association.rma_holds.title=\u0417\u0430\u0431\u043B\u043E\u043A\u0438\u0440\u043E\u0432\u0430\u043D\u043D\u044B\u0435 \u0437\u0430\u043F\u0438\u0441\u0438 +rma_recordsmanagement.association.rma_holds.decription=\u0417\u0430\u0431\u043B\u043E\u043A\u0438\u0440\u043E\u0432\u0430\u043D\u043D\u044B\u0435 \u0437\u0430\u043F\u0438\u0441\u0438 rma_recordsmanagement.association.rma_transfers.title=\u041f\u0435\u0440\u0435\u0434\u0430\u0447\u0438 rma_recordsmanagement.association.rma_transfers.decription=\u041f\u0435\u0440\u0435\u0434\u0430\u0447\u0438 diff --git a/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/report-model_nb.properties b/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/report-model_nb.properties deleted file mode 100644 index b37b15af41..0000000000 --- a/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/report-model_nb.properties +++ /dev/null @@ -1,13 +0,0 @@ -rmr_recordsmanagementreport.description=Oppf\u00f8ringsh\u00e5ndtering til innholdsmodellen - -rmr_recordsmanagementreport.type.rmr_report.title=Rapport -rmr_recordsmanagementreport.type.rmr_report.description=Oppf\u00f8ringsh\u00e5ndteringsrapport - -rmr_recordsmanagementreport.type.rmr_destructionReport.title=Overf\u00f8ringsrapport -rmr_recordsmanagementreport.type.rmr_destructionReport.description=Oppf\u00f8ringsh\u00e5ndteringsrapport med overf\u00f8ringer. - -rmr_recordsmanagementreport.type.rmr_destructionReport.title=Destruksjonsrapport -rmr_recordsmanagementreport.type.rmr_destructionReport.description=Oppf\u00f8ringsh\u00e5ndteringsrapport med destruksjoner. - -rmr_recordsmanagementreport.type.rmr_holdReport.title=Holdrapport -rmr_recordsmanagementreport.type.rmr_holdReport.description=Oppf\u00f8ringsh\u00e5ndteringsrapport med hold. \ No newline at end of file diff --git a/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/report-model_ru.properties b/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/report-model_ru.properties index eb1ae4e117..1ca6ac6b69 100644 --- a/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/report-model_ru.properties +++ b/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/report-model_ru.properties @@ -9,5 +9,5 @@ rmr_recordsmanagementreport.type.rmr_destructionReport.description=\u041e\u0442\ rmr_recordsmanagementreport.type.rmr_destructionReport.title=\u041e\u0442\u0447\u0435\u0442 \u043e\u0431 \u0443\u043d\u0438\u0447\u0442\u043e\u0436\u0435\u043d\u0438\u0438 rmr_recordsmanagementreport.type.rmr_destructionReport.description=\u041e\u0442\u0447\u0435\u0442 \u043e\u0431 \u0443\u043d\u0438\u0447\u0442\u043e\u0436\u0435\u043d\u0438\u0438 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0437\u0430\u043f\u0438\u0441\u044f\u043c\u0438. -rmr_recordsmanagementreport.type.rmr_holdReport.title=\u041e\u0442\u0447\u0435\u0442 \u043e \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u0430\u0445 -rmr_recordsmanagementreport.type.rmr_holdReport.description=\u041e\u0442\u0447\u0435\u0442 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0437\u0430\u043f\u0438\u0441\u044f\u043c\u0438 \u043e \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u0430\u0445. \ No newline at end of file +rmr_recordsmanagementreport.type.rmr_holdReport.title=\u041E\u0442\u0447\u0435\u0442 \u043E \u0431\u043B\u043E\u043A\u0438\u0440\u043E\u0432\u043A\u0430\u0445 +rmr_recordsmanagementreport.type.rmr_holdReport.description=\u041E\u0442\u0447\u0435\u0442 \u0443\u043F\u0440\u0430\u0432\u043B\u0435\u043D\u0438\u044F \u0437\u0430\u043F\u0438\u0441\u044F\u043C\u0438 \u043E \u0431\u043B\u043E\u043A\u0438\u0440\u043E\u0432\u043A\u0430\u0445. \ No newline at end of file diff --git a/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/report-service_nb.properties b/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/report-service_nb.properties deleted file mode 100644 index ab0349861b..0000000000 --- a/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/report-service_nb.properties +++ /dev/null @@ -1 +0,0 @@ -report.default=Rapport \ No newline at end of file diff --git a/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/rm-actions_nb.properties b/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/rm-actions_nb.properties deleted file mode 100644 index 467390eb31..0000000000 --- a/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/rm-actions_nb.properties +++ /dev/null @@ -1,8 +0,0 @@ -# Disposition Actions -cutoff.title=Cut off -cutoff.description=Cut off -retain.title=Behold -retain.description=Behold -destroy.title=Destruer -destroy.description=Destruer - diff --git a/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/rm-events.properties b/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/rm-events.properties index ff7d78eab7..6342449a64 100644 --- a/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/rm-events.properties +++ b/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/rm-events.properties @@ -3,7 +3,6 @@ rmeventservice.rmEventType.simple=Simple Event rmeventservice.rmEventType.obsolete=Obsoleted Event rmeventservice.rmEventType.superseded=Superseded Event rmeventservice.rmEventType.crossReferencedRecordTransfered=Cross Referenced Record Transferred -rmeventservice.rmEventType.versioned=Versioned Event # Default events rmevent.case_closed=Case Closed @@ -11,7 +10,6 @@ rmevent.abolished=Abolished rmevent.re_designated=Redesignated rmevent.no_longer_needed=No longer needed rmevent.superseded=Superseded -rmevent.versioned=Versioned rmevent.study_complete=Study Complete rmevent.training_complete=Training Complete rmevent.related_record_trasfered_inactive_storage=Related Record Transferred To Inactive Storage diff --git a/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/rm-events_de.properties b/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/rm-events_de.properties index a6c622c541..e797067d84 100644 --- a/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/rm-events_de.properties +++ b/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/rm-events_de.properties @@ -3,7 +3,6 @@ rmeventservice.rmEventType.simple=Einfaches Ereignis rmeventservice.rmEventType.obsolete=Ereignis mit veraltetem Record rmeventservice.rmEventType.superseded=Ereignis mit abgel\u00f6stem Record rmeventservice.rmEventType.crossReferencedRecordTransfered=Record mit Querverweis \u00fcbertragen -rmeventservice.rmEventType.versioned=Versioniertes Ereignis # Default events rmevent.case_closed=Fall geschlossen @@ -11,7 +10,6 @@ rmevent.abolished=Aufgehoben rmevent.re_designated=Neu zugewiesen rmevent.no_longer_needed=Nicht mehr ben\u00f6tigt rmevent.superseded=Abgel\u00f6st -rmevent.versioned=Versioniert rmevent.study_complete=Untersuchung abgeschlossen rmevent.training_complete=Training abgeschlossen rmevent.related_record_trasfered_inactive_storage=Zugeh\u00f6riger Record an inaktiven Speicherort \u00fcbertragen diff --git a/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/rm-events_es.properties b/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/rm-events_es.properties index f712f35a5c..9e32f9fc5f 100644 --- a/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/rm-events_es.properties +++ b/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/rm-events_es.properties @@ -3,7 +3,6 @@ rmeventservice.rmEventType.simple=Evento simple rmeventservice.rmEventType.obsolete=Evento obsoleto rmeventservice.rmEventType.superseded=Evento reemplazado rmeventservice.rmEventType.crossReferencedRecordTransfered=Documento de archivo con referencia cruzada transferido -rmeventservice.rmEventType.versioned=Evento versionado # Default events rmevent.case_closed=Caso cerrado @@ -11,7 +10,6 @@ rmevent.abolished=Abolido rmevent.re_designated=Redise\u00f1ado rmevent.no_longer_needed=Ya no se necesita rmevent.superseded=Reemplazado -rmevent.versioned=Versionado rmevent.study_complete=Estudio completo rmevent.training_complete=Formaci\u00f3n completo rmevent.related_record_trasfered_inactive_storage=Documento de archivo relacionado transferido a almacenamiento inactivo diff --git a/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/rm-events_fr.properties b/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/rm-events_fr.properties index a18d97bb55..ebb586cd8d 100644 --- a/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/rm-events_fr.properties +++ b/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/rm-events_fr.properties @@ -1,9 +1,8 @@ # Event Types -rmeventservice.rmEventType.simple=Ev\u00e9nement simple -rmeventservice.rmEventType.obsolete=Ev\u00e9nement obsol\u00e8te -rmeventservice.rmEventType.superseded=Ev\u00e9nement remplac\u00e9 +rmeventservice.rmEventType.simple=\u00c9v\u00e9nement simple +rmeventservice.rmEventType.obsolete=\u00c9v\u00e9nement obsol\u00e8te +rmeventservice.rmEventType.superseded=\u00c9v\u00e9nement remplac\u00e9 rmeventservice.rmEventType.crossReferencedRecordTransfered=Document d'archives avec r\u00e9f\u00e9rence crois\u00e9e transf\u00e9r\u00e9 -rmeventservice.rmEventType.versioned=Ev\u00e9nement versionn\u00e9 # Default events rmevent.case_closed=Cas clos @@ -11,8 +10,7 @@ rmevent.abolished=Aboli rmevent.re_designated=Renomm\u00e9 rmevent.no_longer_needed=Plus n\u00e9cessaire rmevent.superseded=Remplac\u00e9 -rmevent.versioned=Versionn\u00e9 -rmevent.study_complete=Etude termin\u00e9e +rmevent.study_complete=\u00c9tude termin\u00e9e rmevent.training_complete=Formation termin\u00e9e rmevent.related_record_trasfered_inactive_storage=Document d'archives li\u00e9 transf\u00e9r\u00e9 au stockage inactif rmevent.obsolete=Obsol\u00e8te diff --git a/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/rm-events_it.properties b/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/rm-events_it.properties index 11fc965165..95f63a043e 100644 --- a/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/rm-events_it.properties +++ b/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/rm-events_it.properties @@ -3,7 +3,6 @@ rmeventservice.rmEventType.simple=Evento semplice rmeventservice.rmEventType.obsolete=Evento obsoleto rmeventservice.rmEventType.superseded=Evento sostituito rmeventservice.rmEventType.crossReferencedRecordTransfered=Record con rif. incrociati trasferito -rmeventservice.rmEventType.versioned=Evento con versione # Default events rmevent.case_closed=Caso chiuso @@ -11,7 +10,6 @@ rmevent.abolished=Abolito rmevent.re_designated=Riprogettato rmevent.no_longer_needed=Non pi\u00f9 necessario rmevent.superseded=Sostituito -rmevent.versioned=Con versione rmevent.study_complete=Studio completato rmevent.training_complete=Training Completato rmevent.related_record_trasfered_inactive_storage=Record correlato trasferito a Archiviazione inattiva diff --git a/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/rm-events_ja.properties b/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/rm-events_ja.properties index 538b57a1e5..28b4dcb888 100644 --- a/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/rm-events_ja.properties +++ b/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/rm-events_ja.properties @@ -3,7 +3,6 @@ rmeventservice.rmEventType.simple=\u7c21\u6613\u30a4\u30d9\u30f3\u30c8 rmeventservice.rmEventType.obsolete=\u5ec3\u6b62\u30a4\u30d9\u30f3\u30c8 rmeventservice.rmEventType.superseded=\u4ee3\u66ff\u30a4\u30d9\u30f3\u30c8 rmeventservice.rmEventType.crossReferencedRecordTransfered=\u76f8\u4e92\u53c2\u7167\u30ec\u30b3\u30fc\u30c9\u304c\u8ee2\u9001\u6e08\u307f -rmeventservice.rmEventType.versioned=\u30d0\u30fc\u30b8\u30e7\u30f3\u7ba1\u7406\u3055\u308c\u305f\u30a4\u30d9\u30f3\u30c8 # Default events rmevent.case_closed=\u30b1\u30fc\u30b9\u7d42\u4e86 @@ -11,12 +10,11 @@ rmevent.abolished=\u5ec3\u6b62\u6e08\u307f rmevent.re_designated=\u518d\u6307\u5b9a\u6e08\u307f rmevent.no_longer_needed=\u4eca\u5f8c\u4e0d\u8981 rmevent.superseded=\u4ee3\u66ff\u6e08\u307f -rmevent.versioned=\u30d0\u30fc\u30b8\u30e7\u30f3\u7ba1\u7406\u6e08\u307f rmevent.study_complete=\u5b66\u7fd2\u5b8c\u4e86 rmevent.training_complete=\u30c8\u30ec\u30fc\u30cb\u30f3\u30b0\u5b8c\u4e86 rmevent.related_record_trasfered_inactive_storage=\u95a2\u9023\u3059\u308b\u30ec\u30b3\u30fc\u30c9\u304c\u975e\u30a2\u30af\u30c6\u30a3\u30d6\u30b9\u30c8\u30ec\u30fc\u30b8\u306b\u8ee2\u9001\u6e08\u307f rmevent.obsolete=\u5ec3\u6b62 rmevent.all_allowances_granted_are_terminated=\u5831\u916c\u306f\u3059\u3079\u3066\u7d42\u4e86\u3057\u3066\u3044\u308b -rmevent.WGI_action_complete=WGI \u30a2\u30af\u30b7\u30e7\u30f3\u5b8c\u4e86 +rmevent.WGI_action_complete=WGI\u30a2\u30af\u30b7\u30e7\u30f3\u5b8c\u4e86 rmevent.separation=\u5206\u96e2 rmevent.case_complete=\u30b1\u30fc\u30b9\u5b8c\u4e86 \ No newline at end of file diff --git a/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/rm-events_nb.properties b/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/rm-events_nb.properties deleted file mode 100644 index 3191fd332b..0000000000 --- a/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/rm-events_nb.properties +++ /dev/null @@ -1,22 +0,0 @@ -# Event Types -rmeventservice.rmEventType.simple=Enkel hendelse -rmeventservice.rmEventType.obsolete=Utg\u00e5tt hendelse -rmeventservice.rmEventType.superseded=Erstattet hendelse -rmeventservice.rmEventType.crossReferencedRecordTransfered=Oppf\u00f8ring med krysshenvisninger er overf\u00f8rt -rmeventservice.rmEventType.versioned=Oppf\u00f8ring med hendelse - -# Default events -rmevent.case_closed=Sak avslutt -rmevent.abolished=Avskaffet -rmevent.re_designated=Angitt p\u00e5 nytt -rmevent.no_longer_needed=Ikke lenger n\u00f8dvendig -rmevent.superseded=Erstattet -rmevent.versioned=Med versjon -rmevent.study_complete=Studie fullf\u00f8rt -rmevent.training_complete=Oppl\u00e6ring fullf\u00f8rt -rmevent.related_record_trasfered_inactive_storage=Relatert oppf\u00f8ring overf\u00f8rt til inaktiv lagring -rmevent.obsolete=Utg\u00e5tt -rmevent.all_allowances_granted_are_terminated=Alle tillatelser som er gitt, er avsluttet -rmevent.WGI_action_complete=WGI-handling fullf\u00f8rt -rmevent.separation=Separasjon -rmevent.case_complete=Sak fullf\u00f8rt \ No newline at end of file diff --git a/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/rm-events_nl.properties b/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/rm-events_nl.properties index 6f5894c01d..562b62f640 100755 --- a/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/rm-events_nl.properties +++ b/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/rm-events_nl.properties @@ -3,7 +3,6 @@ rmeventservice.rmEventType.simple=Eenvoudige gebeurtenis rmeventservice.rmEventType.obsolete=Verouderde gebeurtenis rmeventservice.rmEventType.superseded=Vervangen gebeurtenis rmeventservice.rmEventType.crossReferencedRecordTransfered=Record met kruisverwijzing overgezet -rmeventservice.rmEventType.versioned=Gebeurtenis met versiebeheer # Default events rmevent.case_closed=Geval gesloten @@ -11,7 +10,6 @@ rmevent.abolished=Vervallen rmevent.re_designated=Opnieuw aangewezen rmevent.no_longer_needed=Niet langer nodig rmevent.superseded=Vervangen -rmevent.versioned=Met versiebeheer rmevent.study_complete=Onderzoek afgerond rmevent.training_complete=Training afgerond rmevent.related_record_trasfered_inactive_storage=Gerelateerde record overgezet naar inactieve opslag diff --git a/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/rm-events_pt_BR.properties b/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/rm-events_pt_BR.properties index 2945e4edde..f4e965a5ab 100644 --- a/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/rm-events_pt_BR.properties +++ b/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/rm-events_pt_BR.properties @@ -3,7 +3,6 @@ rmeventservice.rmEventType.simple=Evento simples rmeventservice.rmEventType.obsolete=Evento obsoleto rmeventservice.rmEventType.superseded=Evento substitu\u00eddo rmeventservice.rmEventType.crossReferencedRecordTransfered=Documento arquiv\u00edstico com refer\u00eancia cruzada transferido -rmeventservice.rmEventType.versioned=Evento em vers\u00e3o # Default events rmevent.case_closed=Caso fechado @@ -11,7 +10,6 @@ rmevent.abolished=Abolido rmevent.re_designated=Redesignado rmevent.no_longer_needed=N\u00e3o mais necess\u00e1rio rmevent.superseded=Substitu\u00eddo -rmevent.versioned=Em vers\u00e3o rmevent.study_complete=Estudo conclu\u00eddo rmevent.training_complete=Treinamento conclu\u00eddo rmevent.related_record_trasfered_inactive_storage=Documento arquiv\u00edstico relacionado transferido para armazenamento inativo diff --git a/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/rm-events_ru.properties b/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/rm-events_ru.properties index de4281e217..512b196145 100644 --- a/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/rm-events_ru.properties +++ b/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/rm-events_ru.properties @@ -3,7 +3,6 @@ rmeventservice.rmEventType.simple=\u041f\u0440\u043e\u0441\u0442\u043e\u0435 \u0 rmeventservice.rmEventType.obsolete=\u0423\u0441\u0442\u0430\u0440\u0435\u0432\u0448\u0435\u0435 \u0441\u043e\u0431\u044b\u0442\u0438\u0435 rmeventservice.rmEventType.superseded=\u0417\u0430\u043c\u0435\u043d\u0435\u043d\u043d\u043e\u0435 \u0441\u043e\u0431\u044b\u0442\u0438\u0435 rmeventservice.rmEventType.crossReferencedRecordTransfered=\u0417\u0430\u043f\u0438\u0441\u044c \u0441 \u043f\u0435\u0440\u0435\u043a\u0440\u0435\u0441\u0442\u043d\u044b\u043c\u0438 \u0441\u0441\u044b\u043b\u043a\u0430\u043c\u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u043d\u0430 -rmeventservice.rmEventType.versioned=\u0421\u043e\u0431\u044b\u0442\u0438\u0435 \u0441 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u0435\u043c \u0432\u0435\u0440\u0441\u0438\u0439 # Default events rmevent.case_closed=\u0421\u043b\u0443\u0447\u0430\u0439 \u0437\u0430\u043a\u0440\u044b\u0442 @@ -11,7 +10,6 @@ rmevent.abolished=\u041e\u0442\u043c\u0435\u043d\u0435\u043d\u043e rmevent.re_designated=\u041f\u0435\u0440\u0435\u0438\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u043e rmevent.no_longer_needed=\u0411\u043e\u043b\u044c\u0448\u0435 \u043d\u0435 \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f rmevent.superseded=\u0417\u0430\u043c\u0435\u043d\u0435\u043d\u043e -rmevent.versioned=\u0421 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u0435\u043c \u0432\u0435\u0440\u0441\u0438\u0439 rmevent.study_complete=\u041e\u0431\u0443\u0447\u0435\u043d\u0438\u0435 \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u043e rmevent.training_complete=\u041a\u0443\u0440\u0441 \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d rmevent.related_record_trasfered_inactive_storage=\u0421\u0432\u044f\u0437\u0430\u043d\u043d\u0430\u044f \u0437\u0430\u043f\u0438\u0441\u044c \u043f\u0435\u0440\u0435\u0434\u0430\u043d\u0430 \u0432 \u043d\u0435\u0430\u043a\u0442\u0438\u0432\u043d\u043e\u0435 \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0435 diff --git a/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/rm-events_zh_CN.properties b/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/rm-events_zh_CN.properties index 54cebe098e..f92dbe8b49 100644 --- a/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/rm-events_zh_CN.properties +++ b/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/rm-events_zh_CN.properties @@ -3,7 +3,6 @@ rmeventservice.rmEventType.simple=\u7b80\u5355\u4e8b\u4ef6 rmeventservice.rmEventType.obsolete=\u8fc7\u65f6\u7684\u4e8b\u4ef6 rmeventservice.rmEventType.superseded=\u88ab\u53d6\u4ee3\u7684\u4e8b\u4ef6 rmeventservice.rmEventType.crossReferencedRecordTransfered=\u5df2\u79fb\u4ea4\u4ea4\u53c9\u53c2\u8003\u8bb0\u5f55 -rmeventservice.rmEventType.versioned=\u7248\u672c\u5316\u4e8b\u4ef6 # Default events rmevent.case_closed=\u6848\u4f8b\u5df2\u7ed3 @@ -11,7 +10,6 @@ rmevent.abolished=\u5df2\u5e9f\u9664 rmevent.re_designated=\u5df2\u91cd\u65b0\u6307\u5b9a rmevent.no_longer_needed=\u4e0d\u518d\u9700\u8981 rmevent.superseded=\u5df2\u88ab\u53d6\u4ee3 -rmevent.versioned=\u7248\u672c\u5316 rmevent.study_complete=\u5b66\u4e60\u5b8c\u6210 rmevent.training_complete=\u57f9\u8bad\u5b8c\u6210 rmevent.related_record_trasfered_inactive_storage=\u76f8\u5173\u8bb0\u5f55\u5df2\u79fb\u4ea4\u81f3\u4e0d\u6d3b\u52a8\u7684\u5b58\u50a8 diff --git a/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/rm-system_nb.properties b/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/rm-system_nb.properties deleted file mode 100644 index c513682c61..0000000000 --- a/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/rm-system_nb.properties +++ /dev/null @@ -1,25 +0,0 @@ -rm.hold.name=Hold - -## Defaut roles -rm.role.extendedReaders=P\u00e5 plass lesere -rm.role.extendedWriters=P\u00e5 plass skribenter -rm.role.user=Bruker av oppf\u00f8ringsh\u00e5ndtering -rm.role.powerUser=Priviligert bruker av oppf\u00f8ringsh\u00e5ndtering -rm.role.securityOfficer=Sikkerhetsansvarlig ved oppf\u00f8ringsh\u00e5ndtering -rm.role.recordsManager=Ansvarlig ved oppf\u00f8ringsh\u00e5ndtering -rm.role.administrator=Administrator ved oppf\u00f8ringsh\u00e5ndtering -rm.role.all=Alle oppf\u00f8ringsh\u00e5ndteringsrollene - -## Default searches -rm.savedsearch.vitalRecordsName=Sv\u00e6rt viktige oppf\u00f8ringer som skal gjennomg\u00e5s -rm.savedsearch.vitalRecordsDesc=Alle oppf\u00f8ringer som n\u00e5 skal gjennomg\u00e5s. -rm.savedsearch.incompleteRecordsName=Ufullstendige oppf\u00f8ringer -rm.savedsearch.incompleteRecordsDesc=Alle ufullstendige oppf\u00f8ringer. -rm.savedsearch.cutoffRecordsName=Oppf\u00f8ringer og oppf\u00f8ringsmapper som er kvalifisert til cut off -rm.savedsearch.cutoffRecordsDesc=Alle oppf\u00f8ringer og oppf\u00f8ringsmapper som for tiden er kvalifisert til cut off. -rm.savedsearch.transferRecordsName=Oppf\u00f8ringer og oppf\u00f8ringsmapper som er kvalifisert til overf\u00f8ring -rm.savedsearch.transferRecordsDesc=Alle oppf\u00f8ringmapper og oppf\u00f8ringer som for tiden er kvalifisert til overf\u00f8ring. -rm.savedsearch.destructionRecordsName=Oppf\u00f8ringer og oppf\u00f8ringsmapper som er kvalifisert til destruksjon -rm.savedsearch.destructionRecordsDesc=Alle oppf\u00f8ringer som for tiden er kvalifisert til destruksjon. -rm.savedsearch.frozenRecordsName= Oppf\u00f8ringer og oppf\u00f8ringsmapper p\u00e5 hold -rm.savedsearch.frozenRecordsDesc=Alle oppf\u00f8ringer og oppf\u00f8ringsmapper for tiden p\u00e5 hold. \ No newline at end of file diff --git a/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/rm-system_ru.properties b/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/rm-system_ru.properties index 85244d18e0..6edbc98e3f 100644 --- a/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/rm-system_ru.properties +++ b/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/rm-system_ru.properties @@ -1,4 +1,4 @@ -rm.hold.name=\u0411\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u0430 +rm.hold.name=\u0411\u043B\u043E\u043A\u0438\u0440\u043E\u0432\u043A\u0430 ## Defaut roles rm.role.extendedReaders=\u041b\u043e\u043a\u0430\u043b\u044c\u043d\u044b\u0435 \u0447\u0438\u0442\u0430\u0442\u0435\u043b\u0438 @@ -21,5 +21,5 @@ rm.savedsearch.transferRecordsName=\u0417\u0430\u043f\u0438\u0441\u0438 \u0438 \ rm.savedsearch.transferRecordsDesc=\u0412\u0441\u0435 \u0437\u0430\u043f\u0438\u0441\u0438 \u0438 \u043f\u0430\u043f\u043a\u0438 \u0437\u0430\u043f\u0438\u0441\u0435\u0439, \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u0435 \u0434\u043b\u044f \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0438 \u043d\u0430 \u0434\u0430\u043d\u043d\u044b\u0439 \u043c\u043e\u043c\u0435\u043d\u0442. rm.savedsearch.destructionRecordsName=\u0417\u0430\u043f\u0438\u0441\u0438 \u0438 \u043f\u0430\u043f\u043a\u0438 \u0437\u0430\u043f\u0438\u0441\u0435\u0439, \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u0435 \u0434\u043b\u044f \u0443\u043d\u0438\u0447\u0442\u043e\u0436\u0435\u043d\u0438\u044f rm.savedsearch.destructionRecordsDesc=\u0412\u0441\u0435 \u0437\u0430\u043f\u0438\u0441\u0438 \u0438 \u043f\u0430\u043f\u043a\u0438 \u0437\u0430\u043f\u0438\u0441\u0435\u0439, \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u0435 \u0434\u043b\u044f \u0443\u043d\u0438\u0447\u0442\u043e\u0436\u0435\u043d\u0438\u044f \u043d\u0430 \u0434\u0430\u043d\u043d\u044b\u0439 \u043c\u043e\u043c\u0435\u043d\u0442. -rm.savedsearch.frozenRecordsName=\u0417\u0430\u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u0437\u0430\u043f\u0438\u0441\u0438 \u0438 \u043f\u0430\u043f\u043a\u0438 \u0437\u0430\u043f\u0438\u0441\u0435\u0439 -rm.savedsearch.frozenRecordsDesc=\u0412\u0441\u0435 \u0437\u0430\u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u0437\u0430\u043f\u0438\u0441\u0438 \u0438 \u043f\u0430\u043f\u043a\u0438 \u0437\u0430\u043f\u0438\u0441\u0435\u0439. \ No newline at end of file +rm.savedsearch.frozenRecordsName=\u0417\u0430\u0431\u043B\u043E\u043A\u0438\u0440\u043E\u0432\u0430\u043D\u043D\u044B\u0435 \u0437\u0430\u043F\u0438\u0441\u0438 \u0438 \u043F\u0430\u043F\u043A\u0438 \u0437\u0430\u043F\u0438\u0441\u0435\u0439 +rm.savedsearch.frozenRecordsDesc=\u0412\u0441\u0435 \u0437\u0430\u0431\u043B\u043E\u043A\u0438\u0440\u043E\u0432\u0430\u043D\u043D\u044B\u0435 \u0437\u0430\u043F\u0438\u0441\u0438 \u0438 \u043F\u0430\u043F\u043A\u0438 \u0437\u0430\u043F\u0438\u0441\u0435\u0439. \ No newline at end of file diff --git a/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/template_fr.properties b/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/template_fr.properties index 991fc18261..6d6454f936 100644 --- a/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/template_fr.properties +++ b/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/template_fr.properties @@ -1,6 +1,6 @@ # File Report Template file.report.acession.report=Rapport sur le versement \u00e0 un autre organisme -file.report.date.format=EEE MMM dd HH:mm:ss zzz yyyy +file.report.date.format=EEE MMM jj HH:mm:ss zzz yyyy file.report.declared.by=d\u00e9clar\u00e9 par file.report.declared.on=le file.report.destroyed=D\u00e9truit diff --git a/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/template_nb.properties b/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/template_nb.properties deleted file mode 100644 index 65d0099313..0000000000 --- a/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/template_nb.properties +++ /dev/null @@ -1,27 +0,0 @@ -# File Report Template -file.report.acession.report=Tilgangsrapport -file.report.date.format=EEE MMM dd HH:mm:ss zzz yyyy -file.report.declared.by=erkl\u00e6rt av -file.report.declared.on=p\u00e5 -file.report.destroyed=Destruert -file.report.destroyed.records=Destruerte oppf\u00f8ringer -file.report.destruction.report=Destruksjonsrapport -file.report.disposition.authority=Disposisjonsrett -file.report.disposition.instructions=Disposisjonsinstruksjoner -file.report.nara=NARA -file.report.transfer.date=Overf\u00f8ringsdato -file.report.transfer.location=Overf\u00f8ringssted -file.report.transfer.report=Overf\u00f8ringsrapport -file.report.transferred.items=Overf\u00f8rte elementer -file.report.performed.by=Utf\u00f8rt av -file.report.record=Oppf\u00f8ring -file.report.record.folder=Oppf\u00f8ringsmappe -file.report.unique.folder.identifier=Unik mappe-ID -file.report.unique.record.identifier=Unik oppf\u00f8rings-ID -file.report.hold.report=Holdrapport -file.report.hold.name=Holdnavn -file.report.hold.description=Holdbeskrivelse -file.report.hold.reason=Grunn til holdet -file.report.hold.held=Hold -file.report.createdby=Opprettet av -file.report.createdon=Opprettet den \ No newline at end of file diff --git a/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/template_nl.properties b/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/template_nl.properties index 43a489c4a4..8743a02e65 100644 --- a/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/template_nl.properties +++ b/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/template_nl.properties @@ -1,6 +1,6 @@ # File Report Template file.report.acession.report=Overdrachtsrapport -file.report.date.format=EEE MMM dd HH:mm:ss zzz yyyy +file.report.date.format=EEE MMM dd UU:mm:ss zzz jjjj file.report.declared.by=gedeclareerd door file.report.declared.on=op file.report.destroyed=Vernietigd diff --git a/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/template_pt_BR.properties b/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/template_pt_BR.properties index c13c4e2edc..777e5fad25 100644 --- a/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/template_pt_BR.properties +++ b/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/template_pt_BR.properties @@ -1,6 +1,6 @@ # File Report Template file.report.acession.report=Relat\u00f3rio de ades\u00e3o -file.report.date.format=EEE MMM dd HH:mm:ss zzz yyyy +file.report.date.format=EEE MMM dd HH:mm:ss zzz aaaa file.report.declared.by=declarado por file.report.declared.on=em file.report.destroyed=Destru\u00eddos diff --git a/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/template_ru.properties b/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/template_ru.properties index 88851814d2..6affcc35a6 100644 --- a/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/template_ru.properties +++ b/rm-server/config/alfresco/module/org_alfresco_module_rm/messages/template_ru.properties @@ -18,10 +18,10 @@ file.report.record=\u0417\u0430\u043f\u0438\u0441\u044c file.report.record.folder=\u041f\u0430\u043f\u043a\u0430 \u0437\u0430\u043f\u0438\u0441\u0435\u0439 file.report.unique.folder.identifier=\u0423\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u0439 \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440 \u043f\u0430\u043f\u043a\u0438 file.report.unique.record.identifier=\u0423\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u0439 \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440 \u0437\u0430\u043f\u0438\u0441\u0438 -file.report.hold.report=\u041e\u0442\u0447\u0435\u0442 \u043e \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u0435 -file.report.hold.name=\u0418\u043c\u044f \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u0438 -file.report.hold.description=\u041e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u0438 -file.report.hold.reason=\u041f\u0440\u0438\u0447\u0438\u043d\u0430 \u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u043a\u0438 -file.report.hold.held=\u0417\u0430\u0431\u043b\u043e\u043a\u0438\u0440\u043e\u0432\u0430\u043d\u043e +file.report.hold.report=\u041e\u0442\u0447\u0435\u0442 \u043e \u0431\u043B\u043E\u043A\u0438\u0440\u043E\u0432\u043A\u0435 +file.report.hold.name=\u0418\u043c\u044f \u0431\u043B\u043E\u043A\u0438\u0440\u043E\u0432\u043A\u0438 +file.report.hold.description=\u041E\u043F\u0438\u0441\u0430\u043D\u0438\u0435 \u0431\u043B\u043E\u043A\u0438\u0440\u043E\u0432\u043A\u0438 +file.report.hold.reason=\u041F\u0440\u0438\u0447\u0438\u043D\u0430 \u0431\u043B\u043E\u043A\u0438\u0440\u043E\u0432\u043A\u0438 +file.report.hold.held=\u0417\u0430\u0431\u043B\u043E\u043A\u0438\u0440\u043E\u0432\u0430\u043D\u043E file.report.createdby=\u0421\u043e\u0437\u0434\u0430\u043d\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u043c file.report.createdon=\u0414\u0430\u0442\u0430 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \ No newline at end of file diff --git a/rm-server/config/alfresco/module/org_alfresco_module_rm/model/recordableVersionModel.xml b/rm-server/config/alfresco/module/org_alfresco_module_rm/model/recordableVersionModel.xml deleted file mode 100644 index 6158bea0b5..0000000000 --- a/rm-server/config/alfresco/module/org_alfresco_module_rm/model/recordableVersionModel.xml +++ /dev/null @@ -1,123 +0,0 @@ - - - - - - - - - - - Recordable Version Model - Roy Wetherall - 1.0 - - - - - - - - - - - - - - - - - - - - - - - - - - - - Recordable Version Policy List - - - NONE - MAJOR_ONLY - ALL - - - false - - - - - - - - - - - - - File Plan - d:noderef - - - - - Recordable Version Policy - d:text - NONE - - - - - - - - - - - - - - - - - Record Node Reference - d:noderef - - - - - Frozen Owner - d:text - - - - - - - - - - - - - d:noderef - - - - - d:text - - - - d:text - - - - - - - \ No newline at end of file diff --git a/rm-server/config/alfresco/module/org_alfresco_module_rm/model/recordsPermissionModel.xml b/rm-server/config/alfresco/module/org_alfresco_module_rm/model/recordsPermissionModel.xml index 59017fcf50..92311a5200 100644 --- a/rm-server/config/alfresco/module/org_alfresco_module_rm/model/recordsPermissionModel.xml +++ b/rm-server/config/alfresco/module/org_alfresco_module_rm/model/recordsPermissionModel.xml @@ -95,7 +95,6 @@ - @@ -184,7 +183,6 @@ - @@ -488,10 +486,6 @@ - - - - \ No newline at end of file diff --git a/rm-server/config/alfresco/module/org_alfresco_module_rm/module-context.xml b/rm-server/config/alfresco/module/org_alfresco_module_rm/module-context.xml index 0a656298a5..1b1674c29f 100644 --- a/rm-server/config/alfresco/module/org_alfresco_module_rm/module-context.xml +++ b/rm-server/config/alfresco/module/org_alfresco_module_rm/module-context.xml @@ -3,15 +3,21 @@ - - - - - - - - + + + + + + + + + + + + + @@ -22,7 +28,6 @@ parent="module.baseComponent"> - @@ -39,13 +44,6 @@ - - - - - - @@ -63,8 +61,7 @@ - - + @@ -105,7 +102,32 @@ - + + + + + + + + + + + + + + + + + + + + + rmService + + + + + @@ -124,51 +146,18 @@ - - - - - - + - - - - - - - - - - - - - - - - - - - - - - - rmService - - - - - @@ -180,7 +169,6 @@ - @@ -239,4 +227,11 @@ + + + + + + + diff --git a/rm-server/config/alfresco/module/org_alfresco_module_rm/module.properties b/rm-server/config/alfresco/module/org_alfresco_module_rm/module.properties index 19d6ed89dd..ece629124a 100644 --- a/rm-server/config/alfresco/module/org_alfresco_module_rm/module.properties +++ b/rm-server/config/alfresco/module/org_alfresco_module_rm/module.properties @@ -6,6 +6,6 @@ module.aliases=org_alfresco_module_dod5015 module.title=Records Management module.description=Alfresco Record Management Extension -module.version=2.3 +module.version=2.2.1 -module.repo.version.min=4.2.2 \ No newline at end of file +module.repo.version.min=4.2 \ No newline at end of file diff --git a/rm-server/config/alfresco/module/org_alfresco_module_rm/patch/rm-patch-context.xml b/rm-server/config/alfresco/module/org_alfresco_module_rm/patch/rm-patch-context.xml index 784324a4ce..8b43fd854c 100755 --- a/rm-server/config/alfresco/module/org_alfresco_module_rm/patch/rm-patch-context.xml +++ b/rm-server/config/alfresco/module/org_alfresco_module_rm/patch/rm-patch-context.xml @@ -9,7 +9,7 @@ - + @@ -31,7 +31,6 @@ - diff --git a/rm-server/config/alfresco/module/org_alfresco_module_rm/patch/rm-patch-v23-context.xml b/rm-server/config/alfresco/module/org_alfresco_module_rm/patch/rm-patch-v23-context.xml deleted file mode 100644 index ac52237135..0000000000 --- a/rm-server/config/alfresco/module/org_alfresco_module_rm/patch/rm-patch-v23-context.xml +++ /dev/null @@ -1,37 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/rm-server/config/alfresco/module/org_alfresco_module_rm/query/rm-query-context.xml b/rm-server/config/alfresco/module/org_alfresco_module_rm/query/rm-query-context.xml index 69f8fb517c..9310260baf 100644 --- a/rm-server/config/alfresco/module/org_alfresco_module_rm/query/rm-query-context.xml +++ b/rm-server/config/alfresco/module/org_alfresco_module_rm/query/rm-query-context.xml @@ -1,10 +1,11 @@ + @@ -16,9 +17,9 @@ - + - + diff --git a/rm-server/config/alfresco/module/org_alfresco_module_rm/rm-action-context.xml b/rm-server/config/alfresco/module/org_alfresco_module_rm/rm-action-context.xml index 0ee64536e6..0c2cddd8ee 100644 --- a/rm-server/config/alfresco/module/org_alfresco_module_rm/rm-action-context.xml +++ b/rm-server/config/alfresco/module/org_alfresco_module_rm/rm-action-context.xml @@ -265,7 +265,7 @@ - + @@ -384,6 +384,7 @@ + @@ -678,7 +679,6 @@ - @@ -817,7 +817,7 @@ - + @@ -845,30 +845,6 @@ - - - - - - - - - - - - - - - org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.execute=RM_CAP.0.rma:filePlanComponent.DeleteLinks - org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementAction.*=RM_ALLOW - org.alfresco.repo.action.executer.ActionExecuter.*=RM_ALLOW - - - - - - - diff --git a/rm-server/config/alfresco/module/org_alfresco_module_rm/rm-audit-context.xml b/rm-server/config/alfresco/module/org_alfresco_module_rm/rm-audit-context.xml index 6f3d2bf7c9..32530d7d69 100644 --- a/rm-server/config/alfresco/module/org_alfresco_module_rm/rm-audit-context.xml +++ b/rm-server/config/alfresco/module/org_alfresco_module_rm/rm-audit-context.xml @@ -16,14 +16,12 @@ - - @@ -87,9 +85,4 @@ - - - - - diff --git a/rm-server/config/alfresco/module/org_alfresco_module_rm/rm-deprecated-context.xml b/rm-server/config/alfresco/module/org_alfresco_module_rm/rm-deprecated-context.xml index 7a855c5149..d472ccb460 100644 --- a/rm-server/config/alfresco/module/org_alfresco_module_rm/rm-deprecated-context.xml +++ b/rm-server/config/alfresco/module/org_alfresco_module_rm/rm-deprecated-context.xml @@ -115,14 +115,14 @@ org.alfresco.module.org_alfresco_module_rm.RecordsManagementService.getNodeRefPath=RM.Read.0 org.alfresco.module.org_alfresco_module_rm.RecordsManagementService.getFilePlan=RM.Read.0,AFTER_RM.FilterNode org.alfresco.module.org_alfresco_module_rm.RecordsManagementService.getFilePlans=RM_ALLOW - org.alfresco.module.org_alfresco_module_rm.RecordsManagementService.createFilePlan=RM.Create.0 + org.alfresco.module.org_alfresco_module_rm.RecordsManagementService.createFilePlan=RM.WRITE.0 org.alfresco.module.org_alfresco_module_rm.RecordsManagementService.getAllContained=RM.Read.0,AFTER_RM.FilterNode org.alfresco.module.org_alfresco_module_rm.RecordsManagementService.getContainedRecordCategories=RM.Read.0,AFTER_RM.FilterNode org.alfresco.module.org_alfresco_module_rm.RecordsManagementService.getContainedRecordFolders=RM.Read.0,AFTER_RM.FilterNode - org.alfresco.module.org_alfresco_module_rm.RecordsManagementService.createRecordCategory=RM.Create.0 + org.alfresco.module.org_alfresco_module_rm.RecordsManagementService.createRecordCategory=RM.Write.0 org.alfresco.module.org_alfresco_module_rm.RecordsManagementService.isRecordFolderDeclared=RM.Read.0 org.alfresco.module.org_alfresco_module_rm.RecordsManagementService.isRecordFolderClosed=RM.Read.0 - org.alfresco.module.org_alfresco_module_rm.RecordsManagementService.createRecordFolder=RM.Create.0 + org.alfresco.module.org_alfresco_module_rm.RecordsManagementService.createRecordFolder=RM.Write.0 org.alfresco.module.org_alfresco_module_rm.RecordsManagementService.getRecords=RM.Read.0,AFTER_RM.FilterNode org.alfresco.module.org_alfresco_module_rm.RecordsManagementService.getRecordFolders=RM.Read.0,AFTER_RM.FilterNode org.alfresco.module.org_alfresco_module_rm.RecordsManagementService.getRecordMetaDataAspects=RM_ALLOW diff --git a/rm-server/config/alfresco/module/org_alfresco_module_rm/rm-model-context.xml b/rm-server/config/alfresco/module/org_alfresco_module_rm/rm-model-context.xml index 1319ba79ef..451ec7e270 100644 --- a/rm-server/config/alfresco/module/org_alfresco_module_rm/rm-model-context.xml +++ b/rm-server/config/alfresco/module/org_alfresco_module_rm/rm-model-context.xml @@ -56,9 +56,6 @@ - - - diff --git a/rm-server/config/alfresco/module/org_alfresco_module_rm/rm-public-services-security-context.xml b/rm-server/config/alfresco/module/org_alfresco_module_rm/rm-public-services-security-context.xml index 13f2102dbe..b64ade5659 100644 --- a/rm-server/config/alfresco/module/org_alfresco_module_rm/rm-public-services-security-context.xml +++ b/rm-server/config/alfresco/module/org_alfresco_module_rm/rm-public-services-security-context.xml @@ -96,9 +96,7 @@ depends-on="CapabilityService"> - - - + diff --git a/rm-server/config/alfresco/module/org_alfresco_module_rm/rm-service-context.xml b/rm-server/config/alfresco/module/org_alfresco_module_rm/rm-service-context.xml index d42f1b3bda..6de002f343 100644 --- a/rm-server/config/alfresco/module/org_alfresco_module_rm/rm-service-context.xml +++ b/rm-server/config/alfresco/module/org_alfresco_module_rm/rm-service-context.xml @@ -31,8 +31,6 @@ - - @@ -167,7 +165,6 @@ - @@ -385,6 +382,10 @@ + + + + @@ -419,11 +420,11 @@ org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService.getFilePlanBySiteId=RM_ALLOW,AFTER_RM.FilterNode org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService.existsUnfiledContainer=RM.Read.0 org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService.getUnfiledContainer=RM.Read.0,AFTER_RM.FilterNode - org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService.createUnfiledContainer=RM.Create.0 + org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService.createUnfiledContainer=RM.Write.0 org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService.getHoldContainer=RM.Read.0,AFTER_RM.FilterNode - org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService.createHoldContainer=RM.Create.0 + org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService.createHoldContainer=RM.Write.0 org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService.getTransferContainer=RM.Read.0,AFTER_RM.FilterNode - org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService.createTransferContainer=RM.Create.0 + org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService.createTransferContainer=RM.Write.0 org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService.createFilePlan=RM_ALLOW org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService.getNodeRefPath=RM.Read.0 org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService.isFilePlanContainer=RM_ALLOW @@ -431,7 +432,7 @@ org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService.getAllContained=RM.Read.0,AFTER_RM.FilterNode org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService.getContainedRecordCategories=RM.Read.0,AFTER_RM.FilterNode org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService.getContainedRecordFolders=RM.Read.0,AFTER_RM.FilterNode - org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService.createRecordCategory=RM.Create.0 + org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService.createRecordCategory=RM.Write.0 org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService.*=RM_DENY ]]> @@ -448,8 +449,6 @@ - - @@ -539,8 +538,8 @@ - - - - - - - + - - - - - - - rma:recordCategory - rma:recordFolder - rma:record - rma:nonElectronicDocument - - - + + + + + + + + + + rma:recordCategory + rma:recordFolder + rma:record + rma:nonElectronicDocument + + + @@ -1024,10 +1020,10 @@ org.alfresco.module.org_alfresco_module_rm.recordfolder.RecordFolderService.isRecordFolder=RM.Read.0 org.alfresco.module.org_alfresco_module_rm.recordfolder.RecordFolderService.isRecordFolderDeclared=RM.Read.0 org.alfresco.module.org_alfresco_module_rm.recordfolder.RecordFolderService.isRecordFolderClosed=RM.Read.0 - org.alfresco.module.org_alfresco_module_rm.recordfolder.RecordFolderService.createRecordFolder=RM.Create.0 + org.alfresco.module.org_alfresco_module_rm.recordfolder.RecordFolderService.createRecordFolder=RM.Write.0 org.alfresco.module.org_alfresco_module_rm.recordfolder.RecordFolderService.getRecordFolders=RM.Read.0,AFTER_RM.FilterNode org.alfresco.module.org_alfresco_module_rm.recordfolder.RecordFolderService.setupRecordFolder=RM.Read.0 - org.alfresco.module.org_alfresco_module_rm.recordfolder.RecordFolderService.closeRecordFolder=RM_CAP.0.rma:filePlanComponent.CloseFolders + org.alfresco.module.org_alfresco_module_rm.recordfolder.RecordFolderService.closeRecordFolder=RM.Write.0 org.alfresco.module.org_alfresco_module_rm.recordfolder.RecordFolderService.*=RM_DENY ]]> @@ -1050,11 +1046,6 @@ - - - - - @@ -1101,16 +1092,14 @@ org.alfresco.module.org_alfresco_module_rm.record.RecordService.disablePropertyEditableCheck=RM_ALLOW org.alfresco.module.org_alfresco_module_rm.record.RecordService.enablePropertyEditableCheck=RM_ALLOW org.alfresco.module.org_alfresco_module_rm.record.RecordService.getRecordMetaDataAspects=RM_ALLOW - org.alfresco.module.org_alfresco_module_rm.record.RecordService.isRecordMetadataAspect=RM_ALLOW - org.alfresco.module.org_alfresco_module_rm.record.RecordService.isRecordMetadataProperty=RM_ALLOW org.alfresco.module.org_alfresco_module_rm.record.RecordService.getRecordMetadataAspects=RM.Read.0 org.alfresco.module.org_alfresco_module_rm.record.RecordService.isRecord=ACL_ALLOW,RM_ALLOW org.alfresco.module.org_alfresco_module_rm.record.RecordService.isDeclared=RM.Read.0 org.alfresco.module.org_alfresco_module_rm.record.RecordService.isFiled=RM.Read.0 org.alfresco.module.org_alfresco_module_rm.record.RecordService.createRecord=RM_ALLOW org.alfresco.module.org_alfresco_module_rm.record.RecordService.createRecordFromContent=RM.Create.0 - org.alfresco.module.org_alfresco_module_rm.record.RecordService.createRecordFromCopy=RM_ALLOW org.alfresco.module.org_alfresco_module_rm.record.RecordService.file=RM_ALLOW + org.alfresco.module.org_alfresco_module_rm.record.RecordService.hideRecord=RM_ALLOW org.alfresco.module.org_alfresco_module_rm.record.RecordService.isPropertyEditable=RM.Read.0 org.alfresco.module.org_alfresco_module_rm.record.RecordService.isMetadataStub=RM.Read.0 org.alfresco.module.org_alfresco_module_rm.record.RecordService.rejectRecord=RM_ALLOW @@ -1118,64 +1107,12 @@ org.alfresco.module.org_alfresco_module_rm.record.RecordService.addRecordType=RM_ALLOW org.alfresco.module.org_alfresco_module_rm.record.RecordService.makeRecord=RM_ALLOW org.alfresco.module.org_alfresco_module_rm.record.RecordService.link=RM_ALLOW - org.alfresco.module.org_alfresco_module_rm.record.RecordService.unlink=RM_ALLOW org.alfresco.module.org_alfresco_module_rm.record.RecordService.*=RM_DENY ]]> - - - - - - - - - - - org.alfresco.module.org_alfresco_module_rm.record.InplaceRecordService - - - - - - - - - - - - - - - - - - - - - - - - ${server.transaction.mode.default} - - - - - - - - - - - - @@ -1525,116 +1462,18 @@ org.alfresco.module.org_alfresco_module_rm.hold.HoldService.getHold=RM.Read.0,AFTER_RM.FilterNode org.alfresco.module.org_alfresco_module_rm.hold.HoldService.heldBy=RM.Read.0,AFTER_RM.FilterNode org.alfresco.module.org_alfresco_module_rm.hold.HoldService.getHeld=RM.Read.0,AFTER_RM.FilterNode - org.alfresco.module.org_alfresco_module_rm.hold.HoldService.createHold=RM_CAP.0.rma:filePlanComponent.CreateHold + org.alfresco.module.org_alfresco_module_rm.hold.HoldService.createHold=RM.Read.0 org.alfresco.module.org_alfresco_module_rm.hold.HoldService.getHoldReason=RM.Read.0 - org.alfresco.module.org_alfresco_module_rm.hold.HoldService.setHoldReason=RM_CAP.0.rma:filePlanComponent.EditHold - org.alfresco.module.org_alfresco_module_rm.hold.HoldService.deleteHold=RM_CAP.0.rma:filePlanComponent.DeleteHold - org.alfresco.module.org_alfresco_module_rm.hold.HoldService.addToHold=RM_CAP.0.rma:filePlanComponent.AddToHold - org.alfresco.module.org_alfresco_module_rm.hold.HoldService.addToHolds=RM_ALLOW - org.alfresco.module.org_alfresco_module_rm.hold.HoldService.removeFromHold=RM_CAP.0.rma:filePlanComponent.RemoveFromHold - org.alfresco.module.org_alfresco_module_rm.hold.HoldService.removeFromHolds=RM_ALLOW - org.alfresco.module.org_alfresco_module_rm.hold.HoldService.removeFromAllHolds=RM_ALLOW + org.alfresco.module.org_alfresco_module_rm.hold.HoldService.setHoldReason=RM.Write.0 + org.alfresco.module.org_alfresco_module_rm.hold.HoldService.deleteHold=RM.Write.0 + org.alfresco.module.org_alfresco_module_rm.hold.HoldService.addToHold=RM.Write.0 + org.alfresco.module.org_alfresco_module_rm.hold.HoldService.addToHolds=RM.Write.0 + org.alfresco.module.org_alfresco_module_rm.hold.HoldService.removeFromHold=RM.Write.0 + org.alfresco.module.org_alfresco_module_rm.hold.HoldService.removeFromHolds=RM.Write.0 + org.alfresco.module.org_alfresco_module_rm.hold.HoldService.removeFromAllHolds=RM.Write.0 org.alfresco.module.org_alfresco_module_rm.hold.HoldService.*=RM_DENY ]]> - - - - - - - - - - org.alfresco.module.org_alfresco_module_rm.relationship.RelationshipService - - - - - - - - - - - - - - - - - - - - ${server.transaction.mode.default} - - - - - - - - - - - - - - - - - - - - - org.alfresco.module.org_alfresco_module_rm.recordableversion.RecordableVersionConfigService - - - - - - - - - - - - - - - - - - - - ${server.transaction.mode.default} - - - - - - - - - - - diff --git a/rm-server/config/alfresco/module/org_alfresco_module_rm/rm-ui-evaluators-context.xml b/rm-server/config/alfresco/module/org_alfresco_module_rm/rm-ui-evaluators-context.xml index 5f8792cc13..5db8392b28 100644 --- a/rm-server/config/alfresco/module/org_alfresco_module_rm/rm-ui-evaluators-context.xml +++ b/rm-server/config/alfresco/module/org_alfresco_module_rm/rm-ui-evaluators-context.xml @@ -6,24 +6,19 @@ - - - + - - + @@ -364,17 +359,6 @@ - - - - - RECORD - - - - - @@ -427,8 +411,6 @@ UNFILED_RECORD_FOLDER HOLD_CONTAINER HOLD - TRANSFER - TRANSFER_CONTAINER @@ -634,21 +616,11 @@ RECORD_CATEGORY - - - - - - - - - UNFILED_RECORD_CONTAINER UNFILED_RECORD_FOLDER - + - - - FILE_PLAN - RECORD_CATEGORY - RECORD_FOLDER - - - - - - - - RECORD - - - - \ No newline at end of file diff --git a/rm-server/config/alfresco/module/org_alfresco_module_rm/rm-version-context.xml b/rm-server/config/alfresco/module/org_alfresco_module_rm/rm-version-context.xml deleted file mode 100644 index ce01a26573..0000000000 --- a/rm-server/config/alfresco/module/org_alfresco_module_rm/rm-version-context.xml +++ /dev/null @@ -1,73 +0,0 @@ - - - - - - - - - - alfresco/module/org_alfresco_module_rm/model/recordableVersionModel.xml - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/rm-server/config/alfresco/module/org_alfresco_module_rm/rm-webscript-context.xml b/rm-server/config/alfresco/module/org_alfresco_module_rm/rm-webscript-context.xml index 7a31fd1b76..c815e3e411 100644 --- a/rm-server/config/alfresco/module/org_alfresco_module_rm/rm-webscript-context.xml +++ b/rm-server/config/alfresco/module/org_alfresco_module_rm/rm-webscript-context.xml @@ -62,32 +62,34 @@ - - - - - + parent="webscript"> + + + parent="rmBaseWebscript"> + + + parent="rmBaseWebscript"> + + - + + @@ -95,7 +97,7 @@ - + @@ -103,7 +105,7 @@ - + @@ -420,7 +422,6 @@ class="org.alfresco.module.org_alfresco_module_rm.script.ApplyDodCertModelFixesGet" parent="webscript"> - @@ -429,7 +430,6 @@ class="org.alfresco.module.org_alfresco_module_rm.script.ApplyFixMob1573Get" parent="webscript"> - @@ -466,6 +466,7 @@ + - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/rm-server/config/alfresco/module/org_alfresco_module_rm/security/rm-default-roles-bootstrap.json b/rm-server/config/alfresco/module/org_alfresco_module_rm/security/rm-default-roles-bootstrap.json index 4f42947a85..faaeb7c1a2 100644 --- a/rm-server/config/alfresco/module/org_alfresco_module_rm/security/rm-default-roles-bootstrap.json +++ b/rm-server/config/alfresco/module/org_alfresco_module_rm/security/rm-default-roles-bootstrap.json @@ -73,7 +73,8 @@ "RequestRecordInformation", "FileUnfiledRecords", "RejectRecords", - "LinkToRecords" + "LinkToRecords", + "ManageAccessControls" ] }, { @@ -124,7 +125,6 @@ "DeleteRecords", "TriggerAnEvent", "CreateModifyDestroyRoles", - "CreateModifyDestroyUsersAndGroups", "PasswordControl", "EnableDisableAuditByTypes", "SelectAuditMetadata", @@ -144,7 +144,7 @@ "FileHoldReport", "DeleteHold", "EditHold", - "EndRetention" + "ManageAccessControls" ] }, { @@ -216,8 +216,7 @@ "RemoveFromHold", "FileHoldReport", "DeleteHold", - "EditHold", - "EndRetention" + "EditHold" ] } ] \ No newline at end of file diff --git a/rm-server/config/alfresco/module/org_alfresco_module_rm/security/rm-method-security.properties b/rm-server/config/alfresco/module/org_alfresco_module_rm/security/rm-method-security.properties index 385b0d397e..928fb0ae67 100644 --- a/rm-server/config/alfresco/module/org_alfresco_module_rm/security/rm-method-security.properties +++ b/rm-server/config/alfresco/module/org_alfresco_module_rm/security/rm-method-security.properties @@ -50,7 +50,6 @@ rm.methodsecurity.org.alfresco.service.cmr.repository.NodeService.getChildAssocs rm.methodsecurity.org.alfresco.service.cmr.repository.NodeService.getNodeRef=RM.Read.0 rm.methodsecurity.org.alfresco.service.cmr.repository.NodeService.getChildAssocsByPropertyValue=RM.Read.0,AFTER_RM.FilterNode rm.methodsecurity.org.alfresco.service.cmr.repository.NodeService.countChildAssocs=RM.Read.0 -rm.methodsecurity.org.alfresco.service.cmr.repository.NodeService.getNodeAclId=RM.Read.0 rm.methodsecurity.org.alfresco.service.cmr.repository.NodeService.*=RM_DENY ## File Folder Service diff --git a/rm-server/config/alfresco/templates/webscripts/org/alfresco/repository/version/rm-version.get.desc.xml b/rm-server/config/alfresco/templates/webscripts/org/alfresco/repository/version/rm-version.get.desc.xml deleted file mode 100644 index 2c7c93f48d..0000000000 --- a/rm-server/config/alfresco/templates/webscripts/org/alfresco/repository/version/rm-version.get.desc.xml +++ /dev/null @@ -1,8 +0,0 @@ - - Node Version Info - Node Version Info including some RM related information - /api/rm/rm-version - - user - required - diff --git a/rm-server/config/alfresco/templates/webscripts/org/alfresco/repository/version/rm-version.get.js b/rm-server/config/alfresco/templates/webscripts/org/alfresco/repository/version/rm-version.get.js deleted file mode 100644 index 00875b74eb..0000000000 --- a/rm-server/config/alfresco/templates/webscripts/org/alfresco/repository/version/rm-version.get.js +++ /dev/null @@ -1,120 +0,0 @@ -var PeopleCache = {}; - -/** - * Gets / caches a person object - * @method getPerson - * @param username {string} User name - */ -function getPerson(username) -{ - if (typeof PeopleCache[username] == "undefined") - { - var person = people.getPerson(username); - if (person == null) - { - if (username == "System" || username.match("^System@") == "System@") - { - // special case for the System users - person = - { - properties: - { - userName: "System", - firstName: "System", - lastName: "User" - }, - assocs: {} - }; - } - else - { - // missing person - may have been deleted from the database - person = - { - properties: - { - userName: username, - firstName: "", - lastName: "" - }, - assocs: {} - }; - } - } - PeopleCache[username] = - { - userName: person.properties.userName, - firstName: person.properties.firstName, - lastName: person.properties.lastName, - displayName: (person.properties.firstName + " " + person.properties.lastName).replace(/^\s+|\s+$/g, "") - }; - } - return PeopleCache[username]; -} - -function main() -{ - var json = "", - versions = []; - - // allow for content to be loaded from id - if (args["nodeRef"] != null) - { - var nodeRef = args["nodeRef"], - node = search.findNode(nodeRef), - versionHistory, version, p, recordNodeRef; - - if (node != null) - { - var versionHistory = node.versionHistory; - if (versionHistory != null) - { - for (i = 0; i < versionHistory.length; i++) - { - version = versionHistory[i]; - p = getPerson(version.creator); - recordNodeRef = version.getVersionProperty("recordNodeRef"); - versions[versions.length] = - { - nodeRef: version.node.nodeRef.toString(), - name: version.node.name, - label: version.label, - description: version.description, - createdDate: version.createdDate, - creator: - { - userName: p.userName, - firstName: p.firstName, - lastName: p.lastName - }, - recordNodeRef: recordNodeRef ? recordNodeRef.toString() : "" - }; - } - } - else - { - p = getPerson(node.properties.creator); - versions[0] = - { - nodeRef: node.nodeRef.toString(), - name: node.name, - label: "1.0", - description: "", - createdDate: node.properties.created, - creator: - { - userName: p.userName, - firstName: p.firstName, - lastName: p.lastName - }, - recordNodeRef: "" - }; - } - } - } - - // store node onto model - model.versions = versions; -} - -main(); \ No newline at end of file diff --git a/rm-server/config/alfresco/templates/webscripts/org/alfresco/repository/version/rm-version.get.json.ftl b/rm-server/config/alfresco/templates/webscripts/org/alfresco/repository/version/rm-version.get.json.ftl deleted file mode 100644 index 84b3ecc3de..0000000000 --- a/rm-server/config/alfresco/templates/webscripts/org/alfresco/repository/version/rm-version.get.json.ftl +++ /dev/null @@ -1,21 +0,0 @@ -<#escape x as jsonUtils.encodeJSONString(x)> -[ -<#list versions as v> - { - "nodeRef": "${v.nodeRef}", - "name": "${v.name}", - "label": "${v.label}", - "description": "${v.description}", - "createdDate": "${v.createdDate?string("dd MMM yyyy HH:mm:ss 'GMT'Z '('zzz')'")}", - "createdDateISO": "${xmldate(v.createdDate)}", - "creator": - { - "userName": "${v.creator.userName}", - "firstName": "${v.creator.firstName!""}", - "lastName": "${v.creator.lastName!""}" - }, - "recordNodeRef": "${v.recordNodeRef}" - }<#if (v_has_next)>, - -] - \ No newline at end of file diff --git a/rm-server/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/rmconstraint.put_nb.properties b/rm-server/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/rmconstraint.put_nb.properties deleted file mode 100644 index 7f27bb9c94..0000000000 --- a/rm-server/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/rmconstraint.put_nb.properties +++ /dev/null @@ -1 +0,0 @@ -rm.admin.list-already-exists=En liste med navnet ''{0}'' finnes allerede. \ No newline at end of file diff --git a/rm-server/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/rmconstraint.put_ru.properties b/rm-server/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/rmconstraint.put_ru.properties index 9cd2609585..2bd7171a07 100644 --- a/rm-server/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/rmconstraint.put_ru.properties +++ b/rm-server/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/rmconstraint.put_ru.properties @@ -1 +1 @@ -rm.admin.list-already-exists=\u0421\u043f\u0438\u0441\u043e\u043a \u0441 \u0438\u043c\u0435\u043d\u0435\u043c ''{0}'' \u0443\u0436\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442. \ No newline at end of file +rm.admin.list-already-exists=\u0421\u043f\u0438\u0441\u043e\u043a \u0441 \u0438\u043c\u0435\u043d\u0435\u043c \u00ab{0}\u00bb \u0443\u0436\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442. \ No newline at end of file diff --git a/rm-server/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/rmconstraints.post_nb.properties b/rm-server/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/rmconstraints.post_nb.properties deleted file mode 100644 index 7f27bb9c94..0000000000 --- a/rm-server/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/rmconstraints.post_nb.properties +++ /dev/null @@ -1 +0,0 @@ -rm.admin.list-already-exists=En liste med navnet ''{0}'' finnes allerede. \ No newline at end of file diff --git a/rm-server/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/rmconstraints.post_ru.properties b/rm-server/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/rmconstraints.post_ru.properties index 9cd2609585..2bd7171a07 100644 --- a/rm-server/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/rmconstraints.post_ru.properties +++ b/rm-server/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmconstraint/rmconstraints.post_ru.properties @@ -1 +1 @@ -rm.admin.list-already-exists=\u0421\u043f\u0438\u0441\u043e\u043a \u0441 \u0438\u043c\u0435\u043d\u0435\u043c ''{0}'' \u0443\u0436\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442. \ No newline at end of file +rm.admin.list-already-exists=\u0421\u043f\u0438\u0441\u043e\u043a \u0441 \u0438\u043c\u0435\u043d\u0435\u043c \u00ab{0}\u00bb \u0443\u0436\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442. \ No newline at end of file diff --git a/rm-server/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmevent/rmeventtypes.get.json.ftl b/rm-server/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmevent/rmeventtypes.get.json.ftl index 9f8d7bd807..21d6c3a7e3 100644 --- a/rm-server/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmevent/rmeventtypes.get.json.ftl +++ b/rm-server/config/alfresco/templates/webscripts/org/alfresco/rma/admin/rmevent/rmeventtypes.get.json.ftl @@ -8,7 +8,7 @@ "${eventtype.name}": { "eventTypeName" : "${eventtype.name}", - "eventTypeDisplayLabel" : "<#if eventtype.displayLabel??>${eventtype.displayLabel}<#else>" + "eventTypeDisplayLabel" : "${eventtype.displayLabel}" }<#if eventtype_has_next>, } diff --git a/rm-server/config/alfresco/templates/webscripts/org/alfresco/rma/relationship.delete.desc.xml b/rm-server/config/alfresco/templates/webscripts/org/alfresco/rma/relationship.delete.desc.xml deleted file mode 100644 index 2b16d435ac..0000000000 --- a/rm-server/config/alfresco/templates/webscripts/org/alfresco/rma/relationship.delete.desc.xml +++ /dev/null @@ -1,8 +0,0 @@ - - Delete records management relationship - Deletes the specified relationship. - /api/node/{store_type}/{store_id}/{id}/targetnode/{target_store_type}/{target_store_id}/{target_id}/uniqueName/{uniqueName} - - user - required - \ No newline at end of file diff --git a/rm-server/config/alfresco/templates/webscripts/org/alfresco/rma/relationship.delete.json.ftl b/rm-server/config/alfresco/templates/webscripts/org/alfresco/rma/relationship.delete.json.ftl deleted file mode 100644 index 3b7961a392..0000000000 --- a/rm-server/config/alfresco/templates/webscripts/org/alfresco/rma/relationship.delete.json.ftl +++ /dev/null @@ -1,3 +0,0 @@ -{ - "success": ${success?string} -} \ No newline at end of file diff --git a/rm-server/config/alfresco/templates/webscripts/org/alfresco/rma/relationshiplabels.get.desc.xml b/rm-server/config/alfresco/templates/webscripts/org/alfresco/rma/relationshiplabels.get.desc.xml deleted file mode 100644 index 4d34693449..0000000000 --- a/rm-server/config/alfresco/templates/webscripts/org/alfresco/rma/relationshiplabels.get.desc.xml +++ /dev/null @@ -1,8 +0,0 @@ - - Records Management Relationship Labels - Gets the list of existing relationship labels. - /api/rma/admin/relationshiplabels - - user - required - \ No newline at end of file diff --git a/rm-server/config/alfresco/templates/webscripts/org/alfresco/rma/relationshiplabels.get.json.ftl b/rm-server/config/alfresco/templates/webscripts/org/alfresco/rma/relationshiplabels.get.json.ftl deleted file mode 100644 index b000b08c1d..0000000000 --- a/rm-server/config/alfresco/templates/webscripts/org/alfresco/rma/relationshiplabels.get.json.ftl +++ /dev/null @@ -1,16 +0,0 @@ -<#escape x as jsonUtils.encodeJSONString(x)> -{ - "data": - { - "relationshipLabels": - [ - <#list relationshipLabels as relationshipLabel> - { - "label": "${relationshipLabel.label}", - "uniqueName": "${relationshipLabel.uniqueName}" - }<#if relationshipLabel_has_next>, - - ] - } -} - \ No newline at end of file diff --git a/rm-server/config/alfresco/templates/webscripts/org/alfresco/rma/relationships.get.desc.xml b/rm-server/config/alfresco/templates/webscripts/org/alfresco/rma/relationships.get.desc.xml deleted file mode 100644 index ea306912b1..0000000000 --- a/rm-server/config/alfresco/templates/webscripts/org/alfresco/rma/relationships.get.desc.xml +++ /dev/null @@ -1,8 +0,0 @@ - - Records Management Relationships - Gets the list of existing relationships on the specified node. - /api/node/{store_type}/{store_id}/{id}/relationships - - user - required - \ No newline at end of file diff --git a/rm-server/config/alfresco/templates/webscripts/org/alfresco/rma/relationships.get.json.ftl b/rm-server/config/alfresco/templates/webscripts/org/alfresco/rma/relationships.get.json.ftl deleted file mode 100644 index ede191397c..0000000000 --- a/rm-server/config/alfresco/templates/webscripts/org/alfresco/rma/relationships.get.json.ftl +++ /dev/null @@ -1,15 +0,0 @@ -<#escape x as jsonUtils.encodeJSONString(x)> -{ - "data": - { - "items": - [ - <#list relationships as relationship> - { - "node": <#noescape>${relationship} - }<#if relationship_has_next>, - - ] - } -} - \ No newline at end of file diff --git a/rm-server/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/recorded-version-config.get.desc.xml b/rm-server/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/recorded-version-config.get.desc.xml deleted file mode 100644 index e61684260a..0000000000 --- a/rm-server/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/recorded-version-config.get.desc.xml +++ /dev/null @@ -1,9 +0,0 @@ - - Gets Recorded Version Config - Gets Recorded Version Config Data - /slingshot/doclib/action/recorded-version-config/node/{store_type}/{store_id}/{id} - argument - user - required - internal - \ No newline at end of file diff --git a/rm-server/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/recorded-version-config.get.json.ftl b/rm-server/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/recorded-version-config.get.json.ftl deleted file mode 100644 index fef4721616..0000000000 --- a/rm-server/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/recorded-version-config.get.json.ftl +++ /dev/null @@ -1,16 +0,0 @@ -<#escape x as jsonUtils.encodeJSONString(x)> -{ - "data": - { - "recordableVersions": - [ - <#list recordableVersions as recordableVersion> - { - "policy": "${recordableVersion.policy}", - "selected": "${recordableVersion.selected?string("true", "false")}" - }<#if recordableVersion_has_next>, - - ] - } -} - \ No newline at end of file diff --git a/rm-server/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/recorded-version-config.post.desc.xml b/rm-server/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/recorded-version-config.post.desc.xml deleted file mode 100644 index d40c295377..0000000000 --- a/rm-server/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/recorded-version-config.post.desc.xml +++ /dev/null @@ -1,9 +0,0 @@ - - Sets Recorded Version Config - Sets Recorded Version Config Data - /slingshot/doclib/action/recorded-version-config/node/{store_type}/{store_id}/{id} - argument - user - required - internal - \ No newline at end of file diff --git a/rm-server/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/recorded-version-config.post.json.ftl b/rm-server/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/recorded-version-config.post.json.ftl deleted file mode 100644 index 9e26dfeeb6..0000000000 --- a/rm-server/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/recorded-version-config.post.json.ftl +++ /dev/null @@ -1 +0,0 @@ -{} \ No newline at end of file diff --git a/rm-server/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/rm-copy-to.post.json.js b/rm-server/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/rm-copy-to.post.json.js index 6240f64306..d30977c673 100644 --- a/rm-server/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/rm-copy-to.post.json.js +++ b/rm-server/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/rm-copy-to.post.json.js @@ -50,7 +50,7 @@ function runAction(p_params) if (!rmService.getRecordsManagementNode(destNode).hasCapability("FillingPermissionOnly")) { result.name = fileNode.name; - result.error = "You don't have filing permission on the destination or the destination is either frozen, closed or cut off!"; + result.error = "The destination is either frozen, closed or cut off!"; results.push(result); continue; } diff --git a/rm-server/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/rm-link.post.json.js b/rm-server/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/rm-link.post.json.js index d25b92dbf2..cd59632202 100644 --- a/rm-server/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/rm-link.post.json.js +++ b/rm-server/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/rm-link.post.json.js @@ -48,7 +48,7 @@ function runAction(p_params) if (!rmService.getRecordsManagementNode(destNode).hasCapability("FillingPermissionOnly")) { result.name = fileNode.name; - result.error = "You don't have filing permission on the destination or the destination is either frozen, closed or cut off!"; + result.error = "The destination is either frozen, closed or cut off!"; results.push(result); continue; } diff --git a/rm-server/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/rm-move-to.post.json.js b/rm-server/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/rm-move-to.post.json.js index a8b66dcce6..e15afd8aa8 100644 --- a/rm-server/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/rm-move-to.post.json.js +++ b/rm-server/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/rm-move-to.post.json.js @@ -50,7 +50,7 @@ function runAction(p_params) if (!rmService.getRecordsManagementNode(destNode).hasCapability("FillingPermissionOnly")) { result.name = fileNode.name; - result.error = "You don't have filing permission on the destination or the destination is either frozen, closed or cut off!"; + result.error = "The destination is either frozen, closed or cut off!"; results.push(result); continue; } diff --git a/rm-server/config/alfresco/workflow/rm-workflow-messages_nb.properties b/rm-server/config/alfresco/workflow/rm-workflow-messages_nb.properties deleted file mode 100644 index 0f41caec1a..0000000000 --- a/rm-server/config/alfresco/workflow/rm-workflow-messages_nb.properties +++ /dev/null @@ -1,23 +0,0 @@ -activitiReviewPooled.workflow.info.requested=Forespurt informasjon til oppf\u00f8ring -activitiReviewPooled.workflow.info.provided=Informasjon som er s\u00f8rget for, til oppf\u00f8ring -activitiReviewPooled.workflow.email.subject=Informasjon som er s\u00f8rget for, til oppf\u00f8ringen -activitiReviewPooled.workflow.email.body1=Brukeren -activitiReviewPooled.workflow.email.body2=har s\u00f8rget for den n\u00f8dvendige informasjonen til oppf\u00f8ringen. - -rmwf_workflowmodel.type.rmwf_workflowTask.title=Arbeidsflytoppgave -rmwf_workflowmodel.type.rmwf_workflowTask.decription=Arbeidsflytoppgave -rmwf_workflowmodel.property.rmwf_requestedInformation.title=Forespurt informasjon -rmwf_workflowmodel.property.rmwf_requestedInformation.decription=Forespurt informasjon -rmwf_workflowmodel.property.rmwf_message.title=Melding -rmwf_workflowmodel.property.rmwf_message.decription=Melding - -rmwf_workflowmodel.type.rmwf_submitRequestInfoTask.title=Be om informasjonsoppgave -rmwf_workflowmodel.type.rmwf_submitRequestInfoTask.description=Be om informasjonsoppgave -rmwf_workflowmodel.association.rmwf_mixedAssignees.title=De som tilordnes -rmwf_workflowmodel.association.rmwf_mixedAssignees.description=De som tilordnes - -rmwf_workflowmodel.type.rmwf_requestInfoTask.title=Be om informasjonsoppgave -rmwf_workflowmodel.type.rmwf_requestInfoTask.description=Be om informasjonsoppgave - -rmwf_workflowmodel.type.rmwf_reviewRequestInfoTask.title=Be om informasjonsoppgave -rmwf_workflowmodel.type.rmwf_reviewRequestInfoTask.description=Be om informasjonsoppgave \ No newline at end of file diff --git a/rm-server/config/springloaded.properties b/rm-server/config/springloaded.properties deleted file mode 100644 index 9f25b216c6..0000000000 --- a/rm-server/config/springloaded.properties +++ /dev/null @@ -1 +0,0 @@ -exclusions=org.alfresco.repo..*,org.alfresco.util..*,org.alfresco.workflow..*,org.alfresco.service..* \ No newline at end of file diff --git a/rm-server/pom.xml b/rm-server/pom.xml index ea364c0be8..c79a190b9a 100644 --- a/rm-server/pom.xml +++ b/rm-server/pom.xml @@ -5,18 +5,13 @@ org.alfresco alfresco-rm-parent - 3.0-SNAPSHOT + 2.2.1-SNAPSHOT 4.0.0 alfresco-rm-server Alfresco RM Server - - /alfresco - 9.1-901.jdbc4 - 5.1.31 - alfresco - ${webapp.id.name} + alfresco source/java @@ -32,31 +27,63 @@ + + org.alfresco.maven.plugin + alfresco-maven-plugin + + + + amp + + + + org.codehaus.mojo build-helper-maven-plugin - add-source - - add-source - - - - source/compatibility - - + add-source + + add-source + + + + source/compatibility + + - add-test-source + add-test-source + + add-test-source + + + + unit-test/java + + + + + + + maven-antrun-plugin + + + prepare-package - add-test-source + run - - unit-test/java - + + + + + + + @@ -101,12 +128,12 @@ postgresql postgresql - ${alfresco.postgres.version} + 9.1-901.jdbc4 mysql mysql-connector-java - ${alfresco.mysql.version} + 5.1.14 @@ -135,277 +162,58 @@ - - fullBuild - - - - org.apache.tomcat.maven - tomcat7-maven-plugin - - - postgresql - postgresql - ${alfresco.postgres.version} - - - mysql - mysql-connector-java - ${alfresco.mysql.version} - - - - - maven-antrun-plugin - - - prepare-package - - run - - - - - - - - - - - - - - - - - - appWarLocationSetting - - ${project.build.directory}/${project.build.finalName}-war - - - - enterprise - - alfresco-enterprise - - - - amp-with-solr - - true - ${project.build.directory}/solr/home - - - - - - org.apache.maven.plugins - maven-dependency-plugin - - - unpack-alfresco - prepare-package - - unpack - - - ${alfresco.client.war.folder} - - - ${alfresco.client.war.groupId} - ${alfresco.client.war} - war - ${alfresco.client.war.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 - 1.8 - - - regex-property - generate-resources - - regex-property - - - solrHomePath - ${alfresco.solr.home} - \\ - / - false - - - - - - - com.google.code.maven-replacer-plugin - replacer - - - setup-solr-config - generate-resources - - replace - - - - - - ${alfresco.solr.home}/context.xml - ${alfresco.solr.home}/archive-SpacesStore/conf/solrcore.properties - ${alfresco.solr.home}/workspace-SpacesStore/conf/solrcore.properties - ${alfresco.client.war.folder}/WEB-INF/web.xml - - - - @@ALFRESCO_SOLR4_DIR@@ - ${alfresco.solr.home}/ - - - @@ALFRESCO_SOLR4_MODEL_DIR@@ - ${alfresco.solr.home}/alfrescoModels/ - - - @@ALFRESCO_SOLR4_CONTENT_DIR@@ - ${alfresco.solr.home}/data/content/ - - - @@ALFRESCO_SOLR4_DATA_DIR@@ - ${alfresco.solr.home}/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 - - - - - - - - - - - org.alfresco.maven - alfresco-rad - ${maven.alfresco.version} - - - org.alfresco - ${webapp.id} + alfresco ${alfresco.base.version} war org.alfresco alfresco-remote-api + ${alfresco.base.version} + + + + org.alfresco + alfresco-data-model + ${alfresco.base.version} + config + + + org.alfresco + alfresco-repository + ${alfresco.base.version} + config + + + org.alfresco + alfresco-remote-api + ${alfresco.base.version} + config junit junit + 4.11 test org.springframework.extensions.surf spring-webscripts - ${alfresco.base.version} + 1.2.0 tests test - org.mockito - mockito-all + org.mockito + mockito-all + 1.9.5 test - + org.springframework spring-test @@ -426,16 +234,23 @@ tests test + + org.apache.chemistry + chemistry-tck-atompub + 0.1-incubating-unreleased + test + postgresql postgresql - ${alfresco.postgres.version} + 9.1-901.jdbc4 test mysql mysql-connector-java + 5.1.14 test @@ -451,5 +266,11 @@ 3.0 test + + + xml-apis + xml-apis + 1.4.01 + \ No newline at end of file diff --git a/rm-server/run-community.sh b/rm-server/run-community.sh deleted file mode 100755 index 6d3f1024d1..0000000000 --- a/rm-server/run-community.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/bash -# Downloads the spring-loaded lib if not existing and runs repository AMP -springloadedfile=~/.m2/repository/org/springframework/springloaded/1.2.0.RELEASE/springloaded-1.2.0.RELEASE.jar - -if [ ! -f $springloadedfile ]; then -mvn validate -Psetup -fi - -MAVEN_OPTS="-javaagent:$springloadedfile -noverify -Xms256m -Xmx2G -XX:PermSize=300m" mvn clean integration-test -PappWarLocationSetting,fullBuild,amp-with-solr -Dsolr.secureComms=none \ No newline at end of file diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/RMActionExecuterAbstractBase.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/RMActionExecuterAbstractBase.java index a7d60157e2..37ce8bea35 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/RMActionExecuterAbstractBase.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/RMActionExecuterAbstractBase.java @@ -64,86 +64,70 @@ public abstract class RMActionExecuterAbstractBase extends PropertySubActionExe BeanNameAware { /** Namespace service */ - private NamespaceService namespaceService; + protected NamespaceService namespaceService; /** Used to control transactional behaviour including post-commit auditing */ - private TransactionService transactionService; + protected TransactionService transactionService; /** Node service */ - private NodeService nodeService; + protected NodeService nodeService; /** Dictionary service */ - private DictionaryService dictionaryService; + protected DictionaryService dictionaryService; /** Content service */ - private ContentService contentService; + protected ContentService contentService; /** Action service */ - private ActionService actionService; + protected ActionService actionService; /** Records management action service */ - private RecordsManagementAuditService recordsManagementAuditService; + protected RecordsManagementAuditService recordsManagementAuditService; /** Records management action service */ - private RecordsManagementActionService recordsManagementActionService; + protected RecordsManagementActionService recordsManagementActionService; /** Record service */ - private RecordService recordService; + protected RecordService recordService; /** Disposition service */ - private DispositionService dispositionService; + protected DispositionService dispositionService; /** Vital record service */ - private VitalRecordService vitalRecordService; + protected VitalRecordService vitalRecordService; /** Records management event service */ - private RecordsManagementEventService recordsManagementEventService; + protected RecordsManagementEventService recordsManagementEventService; /** Records management action service */ - private RecordsManagementAdminService recordsManagementAdminService; + protected RecordsManagementAdminService recordsManagementAdminService; /** Ownable service **/ - private OwnableService ownableService; + protected OwnableService ownableService; /** Freeze service */ - private FreezeService freezeService; + protected FreezeService freezeService; /** Model security service */ - private ModelSecurityService modelSecurityService; + protected ModelSecurityService modelSecurityService; /** Record folder service */ - private RecordFolderService recordFolderService; + protected RecordFolderService recordFolderService; /** Hold service */ - private HoldService holdService; + protected HoldService holdService; /** List of kinds for which this action is applicable */ protected Set applicableKinds = new HashSet(); /** - * Get the transaction service - */ - protected TransactionService getTransactionService() - { - return this.transactionService; - } - - /** - * Set the transaction service + * Set the namespace service */ public void setTransactionService(TransactionService transactionService) { this.transactionService = transactionService; } - /** - * Gets the namespace service - */ - protected NamespaceService getNamespaceService() - { - return this.namespaceService; - } - /** * Set the namespace service */ @@ -152,14 +136,6 @@ public abstract class RMActionExecuterAbstractBase extends PropertySubActionExe this.namespaceService = namespaceService; } - /** - * Gets the node service - */ - protected NodeService getNodeService() - { - return this.nodeService; - } - /** * Set node service */ @@ -168,14 +144,6 @@ public abstract class RMActionExecuterAbstractBase extends PropertySubActionExe this.nodeService = nodeService; } - /** - * Gets the dictionary service - */ - protected DictionaryService getDictionaryService() - { - return this.dictionaryService; - } - /** * Set the dictionary service */ @@ -184,14 +152,6 @@ public abstract class RMActionExecuterAbstractBase extends PropertySubActionExe this.dictionaryService = dictionaryService; } - /** - * Gets the content service - */ - protected ContentService getContentService() - { - return this.contentService; - } - /** * Set the content service */ @@ -200,14 +160,6 @@ public abstract class RMActionExecuterAbstractBase extends PropertySubActionExe this.contentService = contentService; } - /** - * Gets the action service - */ - protected ActionService getActionService() - { - return this.actionService; - } - /** * Set action service */ @@ -216,14 +168,6 @@ public abstract class RMActionExecuterAbstractBase extends PropertySubActionExe this.actionService = actionService; } - /** - * Gets the records management audit service - */ - protected RecordsManagementAuditService getRecordsManagementAuditService() - { - return this.recordsManagementAuditService; - } - /** * Set the audit service that action details will be sent to */ @@ -232,14 +176,6 @@ public abstract class RMActionExecuterAbstractBase extends PropertySubActionExe this.recordsManagementAuditService = recordsManagementAuditService; } - /** - * Gets the records management action service - */ - protected RecordsManagementActionService getRecordsManagementActionService() - { - return this.recordsManagementActionService; - } - /** * Set records management service */ @@ -248,14 +184,6 @@ public abstract class RMActionExecuterAbstractBase extends PropertySubActionExe this.recordsManagementActionService = recordsManagementActionService; } - /** - * Gets the disposition service - */ - protected DispositionService getDispositionService() - { - return this.dispositionService; - } - /** * Set the disposition service */ @@ -264,14 +192,6 @@ public abstract class RMActionExecuterAbstractBase extends PropertySubActionExe this.dispositionService = dispositionService; } - /** - * Gets the vital record service - */ - protected VitalRecordService getVitalRecordService() - { - return this.vitalRecordService; - } - /** * @param vitalRecordService vital record service */ @@ -280,14 +200,6 @@ public abstract class RMActionExecuterAbstractBase extends PropertySubActionExe this.vitalRecordService = vitalRecordService; } - /** - * Gets the records management event service - */ - protected RecordsManagementEventService getRecordsManagementEventService() - { - return this.recordsManagementEventService; - } - /** * Set records management event service */ @@ -296,14 +208,6 @@ public abstract class RMActionExecuterAbstractBase extends PropertySubActionExe this.recordsManagementEventService = recordsManagementEventService; } - /** - * Gets the ownable service - */ - protected OwnableService getOwnableService() - { - return this.ownableService; - } - /** * Set the ownable service * @param ownableSerice @@ -313,14 +217,6 @@ public abstract class RMActionExecuterAbstractBase extends PropertySubActionExe this.ownableService = ownableService; } - /** - * Gets the freeze service - */ - protected FreezeService getFreezeService() - { - return this.freezeService; - } - /** * Set freeze service * @@ -331,14 +227,6 @@ public abstract class RMActionExecuterAbstractBase extends PropertySubActionExe this.freezeService = freezeService; } - /** - * Gets the record service - */ - protected RecordService getRecordService() - { - return this.recordService; - } - /** * Set record service * @@ -349,14 +237,6 @@ public abstract class RMActionExecuterAbstractBase extends PropertySubActionExe this.recordService = recordService; } - /** - * @return records management admin service - */ - protected RecordsManagementAdminService getRecordsManagementAdminService() - { - return recordsManagementAdminService; - } - /** * @param recordsManagementAdminService records management admin service */ @@ -366,11 +246,11 @@ public abstract class RMActionExecuterAbstractBase extends PropertySubActionExe } /** - * Gets the model security service + * @return records management admin service */ - protected ModelSecurityService getModelSecurityService() + public RecordsManagementAdminService getRecordsManagementAdminService() { - return this.modelSecurityService; + return recordsManagementAdminService; } /** @@ -381,14 +261,6 @@ public abstract class RMActionExecuterAbstractBase extends PropertySubActionExe this.modelSecurityService = modelSecurityService; } - /** - * Gets the record folder service - */ - protected RecordFolderService getRecordFolderService() - { - return this.recordFolderService; - } - /** * @param recordFolderService record folder service */ @@ -397,14 +269,6 @@ public abstract class RMActionExecuterAbstractBase extends PropertySubActionExe this.recordFolderService = recordFolderService; } - /** - * Gets the hold service - */ - protected HoldService getHoldService() - { - return this.holdService; - } - /** * @param holdService hold service */ diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/RMDispositionActionExecuterAbstractBase.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/RMDispositionActionExecuterAbstractBase.java index aeda1c56c8..bac84fd8dc 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/RMDispositionActionExecuterAbstractBase.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/RMDispositionActionExecuterAbstractBase.java @@ -117,28 +117,28 @@ public abstract class RMDispositionActionExecuterAbstractBase extends RMActionEx { // Check the eligibility of the action if (!checkEligibility(actionedUponNodeRef) || - getDispositionService().isNextDispositionActionEligible(actionedUponNodeRef)) + dispositionService.isNextDispositionActionEligible(actionedUponNodeRef)) { if (di.isRecordLevelDisposition()) { // Check that we do indeed have a record - if (getRecordService().isRecord(actionedUponNodeRef)) + if (recordService.isRecord(actionedUponNodeRef)) { // Can only execute disposition action on record if declared - if (getRecordService().isDeclared(actionedUponNodeRef)) + if (recordService.isDeclared(actionedUponNodeRef)) { // Indicate that the disposition action is underway - getNodeService().setProperty(nextDispositionActionNodeRef, PROP_DISPOSITION_ACTION_STARTED_AT, new Date()); - getNodeService().setProperty(nextDispositionActionNodeRef, PROP_DISPOSITION_ACTION_STARTED_BY, AuthenticationUtil.getRunAsUser()); + nodeService.setProperty(nextDispositionActionNodeRef, PROP_DISPOSITION_ACTION_STARTED_AT, new Date()); + nodeService.setProperty(nextDispositionActionNodeRef, PROP_DISPOSITION_ACTION_STARTED_BY, AuthenticationUtil.getRunAsUser()); // Execute record level disposition executeRecordLevelDisposition(action, actionedUponNodeRef); - if (getNodeService().exists(nextDispositionActionNodeRef) && + if (nodeService.exists(nextDispositionActionNodeRef) && getSetDispositionActionComplete()) { - getNodeService().setProperty(nextDispositionActionNodeRef, PROP_DISPOSITION_ACTION_COMPLETED_AT, new Date()); - getNodeService().setProperty(nextDispositionActionNodeRef, PROP_DISPOSITION_ACTION_COMPLETED_BY, AuthenticationUtil.getRunAsUser()); + nodeService.setProperty(nextDispositionActionNodeRef, PROP_DISPOSITION_ACTION_COMPLETED_AT, new Date()); + nodeService.setProperty(nextDispositionActionNodeRef, PROP_DISPOSITION_ACTION_COMPLETED_BY, AuthenticationUtil.getRunAsUser()); } } else @@ -153,22 +153,22 @@ public abstract class RMDispositionActionExecuterAbstractBase extends RMActionEx } else { - if (getRecordFolderService().isRecordFolder(actionedUponNodeRef)) + if (recordFolderService.isRecordFolder(actionedUponNodeRef)) { - if (getRecordFolderService().isRecordFolderDeclared(actionedUponNodeRef)) + if (recordFolderService.isRecordFolderDeclared(actionedUponNodeRef)) { // Indicate that the disposition action is underway - getNodeService().setProperty(nextDispositionActionNodeRef, PROP_DISPOSITION_ACTION_STARTED_AT, new Date()); - getNodeService().setProperty(nextDispositionActionNodeRef, PROP_DISPOSITION_ACTION_STARTED_BY, AuthenticationUtil.getRunAsUser()); + nodeService.setProperty(nextDispositionActionNodeRef, PROP_DISPOSITION_ACTION_STARTED_AT, new Date()); + nodeService.setProperty(nextDispositionActionNodeRef, PROP_DISPOSITION_ACTION_STARTED_BY, AuthenticationUtil.getRunAsUser()); executeRecordFolderLevelDisposition(action, actionedUponNodeRef); // Indicate that the disposition action is compelte - if (getNodeService().exists(nextDispositionActionNodeRef) && + if (nodeService.exists(nextDispositionActionNodeRef) && getSetDispositionActionComplete()) { - getNodeService().setProperty(nextDispositionActionNodeRef, PROP_DISPOSITION_ACTION_COMPLETED_AT, new Date()); - getNodeService().setProperty(nextDispositionActionNodeRef, PROP_DISPOSITION_ACTION_COMPLETED_BY, AuthenticationUtil.getRunAsUser()); + nodeService.setProperty(nextDispositionActionNodeRef, PROP_DISPOSITION_ACTION_COMPLETED_AT, new Date()); + nodeService.setProperty(nextDispositionActionNodeRef, PROP_DISPOSITION_ACTION_COMPLETED_BY, AuthenticationUtil.getRunAsUser()); } } @@ -184,10 +184,10 @@ public abstract class RMDispositionActionExecuterAbstractBase extends RMActionEx } - if (getNodeService().exists(actionedUponNodeRef) && getSetDispositionActionComplete()) + if (nodeService.exists(actionedUponNodeRef) && getSetDispositionActionComplete()) { // Update the disposition schedule - getDispositionService().updateNextDispositionAction(actionedUponNodeRef); + dispositionService.updateNextDispositionAction(actionedUponNodeRef); } } else @@ -225,7 +225,7 @@ public abstract class RMDispositionActionExecuterAbstractBase extends RMActionEx protected DispositionSchedule checkDispositionActionExecutionValidity(NodeRef nodeRef, NodeRef nextDispositionActionNodeRef, boolean throwError) { // Check the node has associated disposition instructions - DispositionSchedule di = getDispositionService().getDispositionSchedule(nodeRef); + DispositionSchedule di = dispositionService.getDispositionSchedule(nodeRef); if (di == null) { if (throwError) @@ -239,7 +239,7 @@ public abstract class RMDispositionActionExecuterAbstractBase extends RMActionEx } // Check the node has the disposition schedule aspect applied - if (!getNodeService().hasAspect(nodeRef, ASPECT_DISPOSITION_LIFECYCLE)) + if (!nodeService.hasAspect(nodeRef, ASPECT_DISPOSITION_LIFECYCLE)) { if (throwError) { @@ -266,7 +266,7 @@ public abstract class RMDispositionActionExecuterAbstractBase extends RMActionEx return null; } } - String actionName = (String) getNodeService().getProperty(nextDispositionAction, PROP_DISPOSITION_ACTION); + String actionName = (String) nodeService.getProperty(nextDispositionAction, PROP_DISPOSITION_ACTION); if (actionName == null || !actionName.equals(getName())) { if (throwError) @@ -293,7 +293,7 @@ public abstract class RMDispositionActionExecuterAbstractBase extends RMActionEx private NodeRef getNextDispostionAction(NodeRef nodeRef) { NodeRef result = null; - List assocs = getNodeService().getChildAssocs(nodeRef, ASSOC_NEXT_DISPOSITION_ACTION, RegexQNamePattern.MATCH_ALL); + List assocs = nodeService.getChildAssocs(nodeRef, ASSOC_NEXT_DISPOSITION_ACTION, RegexQNamePattern.MATCH_ALL); if (assocs.size() != 0) { result = assocs.get(0).getChildRef(); diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/ScheduledDispositionJob.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/ScheduledDispositionJob.java index be14759848..397239c9d5 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/ScheduledDispositionJob.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/ScheduledDispositionJob.java @@ -84,7 +84,7 @@ public class ScheduledDispositionJob implements Job String query = "+ASPECT:\"rma:record\" +ASPECT:\"rma:dispositionSchedule\" +@rma\\:dispositionAsOf:" + dateRange; SearchService search = (SearchService)context.getJobDetail().getJobDataMap().get("searchService"); - ResultSet results = search.query(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, SearchService.LANGUAGE_FTS_ALFRESCO, query); + ResultSet results = search.query(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, SearchService.LANGUAGE_LUCENE, query); List resultNodes = results.getNodeRefs(); results.close(); diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/constraint/VersionParameterConstraint.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/constraint/VersionParameterConstraint.java deleted file mode 100644 index c1677f84d8..0000000000 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/constraint/VersionParameterConstraint.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright (C) 2005-2014 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - */ -package org.alfresco.module.org_alfresco_module_rm.action.constraint; - -import java.util.HashMap; -import java.util.Map; - -import org.alfresco.module.org_alfresco_module_rm.version.RecordableVersionPolicy; -import org.alfresco.repo.action.constraint.BaseParameterConstraint; - -/** - * Recordable version config constraint - * - * @author Tuna Aksoy - * @since 2.3 - */ -public class VersionParameterConstraint extends BaseParameterConstraint -{ - /** - * @see org.alfresco.repo.action.constraint.BaseParameterConstraint#getAllowableValuesImpl() - */ - @Override - protected Map getAllowableValuesImpl() - { - RecordableVersionPolicy[] recordableVersionPolicies = RecordableVersionPolicy.values(); - Map allowableValues = new HashMap(recordableVersionPolicies.length); - for (RecordableVersionPolicy recordableVersionPolicy : recordableVersionPolicies) - { - String policy = recordableVersionPolicy.toString(); - allowableValues.put(policy, getI18NLabel(policy)); - } - return allowableValues; - } -} diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/dm/DeclareAsVersionRecordAction.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/dm/DeclareAsVersionRecordAction.java deleted file mode 100644 index 07a8e951ed..0000000000 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/dm/DeclareAsVersionRecordAction.java +++ /dev/null @@ -1,235 +0,0 @@ -/* - * Copyright (C) 2005-2014 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - */ -package org.alfresco.module.org_alfresco_module_rm.action.dm; - -import java.util.List; - -import org.alfresco.error.AlfrescoRuntimeException; -import org.alfresco.model.ContentModel; -import org.alfresco.module.org_alfresco_module_rm.action.AuditableActionExecuterAbstractBase; -import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService; -import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; -import org.alfresco.module.org_alfresco_module_rm.util.AuthenticationUtil; -import org.alfresco.module.org_alfresco_module_rm.version.RecordableVersionService; -import org.alfresco.service.cmr.action.Action; -import org.alfresco.service.cmr.action.ParameterDefinition; -import org.alfresco.service.cmr.dictionary.DictionaryService; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.repository.NodeService; -import org.alfresco.service.namespace.QName; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -/** - * Creates a new record from the 'current' document version. - * - * Note: This is a 'normal' dm action, rather than a records management action. - * - * @author Roy Wetherall - */ -public class DeclareAsVersionRecordAction extends AuditableActionExecuterAbstractBase - implements RecordsManagementModel -{ - /** Logger */ - private static Log logger = LogFactory.getLog(DeclareAsVersionRecordAction.class); - - /** Action name */ - public static final String NAME = "declare-version-record"; - - /** Parameter names */ - public static final String PARAM_FILE_PLAN = "file-plan"; - - /** Sync Model URI */ - private static final String SYNC_MODEL_1_0_URI = "http://www.alfresco.org/model/sync/1.0"; - - /** Synced aspect */ - private static final QName ASPECT_SYNCED = QName.createQName(SYNC_MODEL_1_0_URI, "synced"); - - /** Node service */ - private NodeService nodeService; - - /** File plan service */ - private FilePlanService filePlanService; - - /** Dictionary service */ - private DictionaryService dictionaryService; - - /** recordable version service */ - private RecordableVersionService recordableVersionService; - - /** authentication util */ - private AuthenticationUtil authenticationUtil; - - /** - * @param nodeService node service - */ - public void setNodeService(NodeService nodeService) - { - this.nodeService = nodeService; - } - - /** - * @param filePlanService file plan service - */ - public void setFilePlanService(FilePlanService filePlanService) - { - this.filePlanService = filePlanService; - } - - /** - * @param dictionaryService dictionary service - */ - public void setDictionaryService(DictionaryService dictionaryService) - { - this.dictionaryService = dictionaryService; - } - - /** - * @param recordableVersionService recordable version service - */ - public void setRecordableVersionService(RecordableVersionService recordableVersionService) - { - this.recordableVersionService = recordableVersionService; - } - - /** - * @param authenticationUtil authentication util - */ - public void setAuthenticationUtil(AuthenticationUtil authenticationUtil) - { - this.authenticationUtil = authenticationUtil; - } - - /** - * @see org.alfresco.repo.action.executer.ActionExecuterAbstractBase#executeImpl(org.alfresco.service.cmr.action.Action, org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - protected void executeImpl(final Action action, final NodeRef actionedUponNodeRef) - { - if (!nodeService.exists(actionedUponNodeRef)) - { - // do not create record if the actioned upon node does not exist! - if (logger.isDebugEnabled()) - { - logger.debug("Can not declare version as record, because " + actionedUponNodeRef.toString() + " does not exist."); - } - } - else if (!dictionaryService.isSubClass(nodeService.getType(actionedUponNodeRef), ContentModel.TYPE_CONTENT)) - { - // TODO eventually we should support other types .. either as record folders or as composite records - if (logger.isDebugEnabled()) - { - logger.debug("Can not declare version as record, because " + actionedUponNodeRef.toString() + " is not a supported type."); - } - } - else if (!nodeService.hasAspect(actionedUponNodeRef, ContentModel.ASPECT_VERSIONABLE)) - { - if (logger.isDebugEnabled()) - { - logger.debug("Can not declare version record, because " + actionedUponNodeRef.toString() + " does not have the versionable aspect applied."); - } - } - else if (nodeService.hasAspect(actionedUponNodeRef, ASPECT_RECORD)) - { - // Do not declare version record if the actioned upon node is already a record! - if (logger.isDebugEnabled()) - { - logger.debug("Can not declare version record, because " + actionedUponNodeRef.toString() + " is already a record."); - } - } - else if (nodeService.hasAspect(actionedUponNodeRef, ContentModel.ASPECT_WORKING_COPY)) - { - // We can not create records from working copies - if (logger.isDebugEnabled()) - { - logger.debug("Can not declare version record, because " + actionedUponNodeRef.toString() + " is a working copy."); - } - - } - else if (nodeService.hasAspect(actionedUponNodeRef, ASPECT_RECORD_REJECTION_DETAILS)) - { - // can not create a record from a previously rejected one - if (logger.isDebugEnabled()) - { - logger.debug("Can not declare version record, because " + actionedUponNodeRef.toString() + " has previously been rejected."); - } - } - else if (nodeService.hasAspect(actionedUponNodeRef, ASPECT_SYNCED)) - { - // can't declare the record if the node is sync'ed - if (logger.isDebugEnabled()) - { - logger.debug("Can't declare version record, because " + actionedUponNodeRef.toString() + " is synched content."); - } - } - else - { - NodeRef filePlan = (NodeRef)action.getParameterValue(PARAM_FILE_PLAN); - if (filePlan == null) - { - // TODO .. eventually make the file plan parameter required - - filePlan = authenticationUtil.runAs(new org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork() - { - @Override - public NodeRef doWork() - { - return filePlanService.getFilePlanBySiteId(FilePlanService.DEFAULT_RM_SITE_ID); - } - }, authenticationUtil.getAdminUserName()); - - // if the file plan is still null, raise an exception - if (filePlan == null) - { - if (logger.isDebugEnabled()) - { - logger.debug("Can not declare version record, because the default file plan can not be determined. Make sure at least one file plan has been created."); - } - throw new AlfrescoRuntimeException("Can not declare version record, because the default file plan can not be determined."); - } - } - else - { - // verify that the provided file plan is actually a file plan - if (!filePlanService.isFilePlan(filePlan)) - { - if (logger.isDebugEnabled()) - { - logger.debug("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."); - } - } - - // create record from latest version - recordableVersionService.createRecordFromLatestVersion(filePlan, actionedUponNodeRef); - } - } - - /** - * @see org.alfresco.repo.action.ParameterizedItemAbstractBase#addParameterDefinitions(java.util.List) - */ - @Override - protected void addParameterDefinitions(List params) - { - // NOTE: commented out for now so that it doesn't appear in the UI ... enable later when multi-file plan support is added - //params.add(new ParameterDefinitionImpl(PARAM_FILE_PLAN, DataTypeDefinition.NODE_REF, false, getParamDisplayLabel(PARAM_FILE_PLAN))); - } - -} diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/dm/HideRecordAction.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/dm/HideRecordAction.java index 011a7fcbe1..b3e50912ac 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/dm/HideRecordAction.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/dm/HideRecordAction.java @@ -22,7 +22,7 @@ import java.util.List; import org.alfresco.module.org_alfresco_module_rm.action.AuditableActionExecuterAbstractBase; import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; -import org.alfresco.module.org_alfresco_module_rm.record.InplaceRecordService; +import org.alfresco.module.org_alfresco_module_rm.record.RecordService; import org.alfresco.service.cmr.action.Action; import org.alfresco.service.cmr.action.ParameterDefinition; import org.alfresco.service.cmr.repository.NodeRef; @@ -39,7 +39,7 @@ import org.apache.commons.logging.LogFactory; * @since 2.1 */ public class HideRecordAction extends AuditableActionExecuterAbstractBase - implements RecordsManagementModel + implements RecordsManagementModel { /** Logger */ @@ -51,8 +51,8 @@ public class HideRecordAction extends AuditableActionExecuterAbstractBase /** Node service */ private NodeService nodeService; - /** Inplace record service */ - private InplaceRecordService inplaceRecordService; + /** Record service */ + private RecordService recordService; /** * @param nodeService node service @@ -63,11 +63,11 @@ public class HideRecordAction extends AuditableActionExecuterAbstractBase } /** - * @param inplaceRecordService inplace record service + * @param recordService record service */ - public void setInplaceRecordService(InplaceRecordService inplaceRecordService) + public void setRecordService(RecordService recordService) { - this.inplaceRecordService = inplaceRecordService; + this.recordService = recordService; } /** @@ -87,7 +87,7 @@ public class HideRecordAction extends AuditableActionExecuterAbstractBase else { // hide the record from the collaboration site - inplaceRecordService.hideRecord(actionedUponNodeRef); + recordService.hideRecord(actionedUponNodeRef); } } diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/dm/MoveDmRecordAction.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/dm/MoveDmRecordAction.java deleted file mode 100644 index e0898671ad..0000000000 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/dm/MoveDmRecordAction.java +++ /dev/null @@ -1,143 +0,0 @@ -/* - * Copyright (C) 2005-2014 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - */ -package org.alfresco.module.org_alfresco_module_rm.action.dm; - -import java.util.List; - -import org.alfresco.error.AlfrescoRuntimeException; -import org.alfresco.module.org_alfresco_module_rm.action.AuditableActionExecuterAbstractBase; -import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; -import org.alfresco.module.org_alfresco_module_rm.record.InplaceRecordService; -import org.alfresco.service.cmr.action.Action; -import org.alfresco.service.cmr.action.ParameterDefinition; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.repository.NodeService; -import org.apache.commons.lang.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -/** - * Moves a record within a collaboration site. - * The record can be moved only within the collaboration site where it was declared. - * - * @author Tuna Aksoy - * @since 2.3 - */ -public class MoveDmRecordAction extends AuditableActionExecuterAbstractBase implements RecordsManagementModel -{ - /** Logger */ - private static Log logger = LogFactory.getLog(MoveDmRecordAction.class); - - /** Action name */ - public static final String NAME = "move-dm-record"; - - /** Constant for target node reference parameter */ - public static final String PARAM_TARGET_NODE_REF = "targetNodeRef"; - - /** Node service */ - private NodeService nodeService; - - /** Inplace record service */ - private InplaceRecordService inplaceRecordService; - - /** - * Gets the node service - * - * @return Node service - */ - protected NodeService getNodeService() - { - return this.nodeService; - } - - /** - * Sets the node service - * - * @param nodeService Node service - */ - public void setNodeService(NodeService nodeService) - { - this.nodeService = nodeService; - } - - /** - * Gets the inplace record service - * - * @return Inplace record service - */ - protected InplaceRecordService getInplaceRecordService() - { - return this.inplaceRecordService; - } - - /** - * Sets the inplace record service - * - * @param InplaceRecordService Inplace record service - */ - public void setInplaceRecordService(InplaceRecordService inplaceRecordService) - { - this.inplaceRecordService = inplaceRecordService; - } - - /** - * @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) - { - // Cannot move a document which is not a record - if (!getNodeService().hasAspect(actionedUponNodeRef, ASPECT_RECORD) && logger.isDebugEnabled()) - { - logger.debug("Cannot move the document, because '" + actionedUponNodeRef.toString() + "' is not a record."); - } - else - { - // Move the record within the collaboration site - getInplaceRecordService().moveRecord(actionedUponNodeRef, getTargetNodeRef(action)); - } - } - - /** - * Helper method to get the target node reference from the action parameter - * - * @param action The action - * @return Node reference of the target - */ - private NodeRef getTargetNodeRef(Action action) - { - String targetNodeRef = (String) action.getParameterValue(PARAM_TARGET_NODE_REF); - - if (StringUtils.isBlank(targetNodeRef)) - { - throw new AlfrescoRuntimeException("Could not find target node reference."); - } - - return new NodeRef(targetNodeRef); - } - - /** - * @see org.alfresco.repo.action.ParameterizedItemAbstractBase#addParameterDefinitions(java.util.List) - */ - @Override - protected void addParameterDefinitions(List paramList) - { - // Intentionally empty - } -} diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/dm/RecordableVersionConfigAction.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/dm/RecordableVersionConfigAction.java deleted file mode 100644 index b9ce07b602..0000000000 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/dm/RecordableVersionConfigAction.java +++ /dev/null @@ -1,195 +0,0 @@ -/* - * Copyright (C) 2005-2014 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - */ -package org.alfresco.module.org_alfresco_module_rm.action.dm; - -import static org.alfresco.model.ContentModel.ASPECT_VERSIONABLE; -import static org.alfresco.model.ContentModel.TYPE_CONTENT; -import static org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel.ASPECT_RECORD; -import static org.alfresco.module.org_alfresco_module_rm.version.RecordableVersionModel.PROP_RECORDABLE_VERSION_POLICY; -import static org.alfresco.service.cmr.dictionary.DataTypeDefinition.TEXT; -import static org.apache.commons.logging.LogFactory.getLog; - -import java.util.List; - -import org.alfresco.module.org_alfresco_module_rm.version.RecordableVersionPolicy; -import org.alfresco.repo.action.ParameterDefinitionImpl; -import org.alfresco.repo.action.executer.ActionExecuterAbstractBase; -import org.alfresco.service.cmr.action.Action; -import org.alfresco.service.cmr.action.ParameterDefinition; -import org.alfresco.service.cmr.dictionary.DictionaryService; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.repository.NodeService; -import org.alfresco.service.namespace.QName; -import org.apache.commons.logging.Log; - -/** - * Sets the recordable version config for a document within a collaboration site. - * - * Note: This is a 'normal' dm action, rather than a records management action. - * - * @author Tuna Aksoy - * @since 2.3 - */ -public class RecordableVersionConfigAction extends ActionExecuterAbstractBase -{ - /** Logger */ - private static Log LOGGER = getLog(RecordableVersionConfigAction.class); - - /** Action name */ - public static final String NAME = "recordable-version-config"; - - /** Parameter names */ - public static final String PARAM_VERSION = "version"; - - /** Node service */ - private NodeService nodeService; - - /** Dictionary service */ - private DictionaryService dictionaryService; - - /** - * Gets the node service - * - * @return The node service - */ - protected NodeService getNodeService() - { - return this.nodeService; - } - - /** - * Sets the node service - * - * @param nodeService The node service - */ - public void setNodeService(NodeService nodeService) - { - this.nodeService = nodeService; - } - - /** - * Gets the dictionary service - * - * @return The dictionary service - */ - protected DictionaryService getDictionaryService() - { - return this.dictionaryService; - } - - /** - * @see org.alfresco.repo.action.executer.ActionExecuterAbstractBase#setDictionaryService(org.alfresco.service.cmr.dictionary.DictionaryService) - */ - public void setDictionaryService(DictionaryService dictionaryService) - { - this.dictionaryService = dictionaryService; - } - - /** - * @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 (passedChecks(actionedUponNodeRef)) - { - String version = (String) action.getParameterValue(PARAM_VERSION); - getNodeService().setProperty(actionedUponNodeRef, PROP_RECORDABLE_VERSION_POLICY, RecordableVersionPolicy.valueOf(version)); - } - } - - /** - * @see org.alfresco.repo.action.ParameterizedItemAbstractBase#addParameterDefinitions(java.util.List) - */ - @Override - protected void addParameterDefinitions(List paramList) - { - paramList.add(new ParameterDefinitionImpl(PARAM_VERSION, TEXT, true, getParamDisplayLabel(PARAM_VERSION), false, "ac-versions")); - } - - /** - * Helper method to do checks on the actioned upon node reference - * - * @param actionedUponNodeRef The actioned upon node reference - * @return true if the actioned upon node reference passes the checks, false otherwise - */ - private boolean passedChecks(NodeRef actionedUponNodeRef) - { - boolean passedChecks = true; - - if (!getNodeService().exists(actionedUponNodeRef)) - { - passedChecks = false; - if (LOGGER.isDebugEnabled()) - { - String message = buildLogMessage(actionedUponNodeRef, "' because the node does not exist."); - LOGGER.debug(message); - } - } - - QName type = getNodeService().getType(actionedUponNodeRef); - if (!getDictionaryService().isSubClass(type, TYPE_CONTENT)) - { - passedChecks = false; - if (LOGGER.isDebugEnabled()) - { - String message = buildLogMessage(actionedUponNodeRef, "' because the type of the node '" + type.getLocalName() + "' is not supported."); - LOGGER.debug(message); - } - } - - if (getNodeService().hasAspect(actionedUponNodeRef, ASPECT_RECORD)) - { - passedChecks = false; - if (LOGGER.isDebugEnabled()) - { - String message = buildLogMessage(actionedUponNodeRef, "' because the rule cannot be applied to records."); - LOGGER.debug(message); - } - } - - if (!getNodeService().hasAspect(actionedUponNodeRef, ASPECT_VERSIONABLE)) - { - passedChecks = false; - if (LOGGER.isDebugEnabled()) - { - String buildLogMessage = buildLogMessage(actionedUponNodeRef, "' because the rule cannot be applied to records."); - LOGGER.debug(buildLogMessage); - } - } - - return passedChecks; - } - - /** - * Helper method to construct log message - * - * @param actionedUponNodeRef The actioned upon node reference - * @param messagePart The message which should be appended. - * @return The constructed log message - */ - private String buildLogMessage(NodeRef actionedUponNodeRef, String messagePart) - { - StringBuilder sb = new StringBuilder(); - sb.append("Cannot set recordable version config for '"); - sb.append(actionedUponNodeRef.toString()); - sb.append(messagePart); - return sb.toString(); - } -} diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/AddRecordTypeAction.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/AddRecordTypeAction.java index 61281dbd6c..7ae40752bb 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/AddRecordTypeAction.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/AddRecordTypeAction.java @@ -65,7 +65,7 @@ public class AddRecordTypeAction extends RMActionExecuterAbstractBase { for (String type : getRecordTypes(action)) { - getRecordService().addRecordType(actionedUponNodeRef, QName.createQName(type, getNamespaceService())); + recordService.addRecordType(actionedUponNodeRef, QName.createQName(type, namespaceService)); } } else if (logger.isWarnEnabled()) @@ -88,10 +88,10 @@ public class AddRecordTypeAction extends RMActionExecuterAbstractBase private boolean eligibleForAction(NodeRef actionedUponNodeRef) { boolean result = false; - if (getNodeService().exists(actionedUponNodeRef) && - !getFreezeService().isFrozen(actionedUponNodeRef) && - getRecordService().isRecord(actionedUponNodeRef) && - !getRecordService().isDeclared(actionedUponNodeRef)) + if (nodeService.exists(actionedUponNodeRef) && + !freezeService.isFrozen(actionedUponNodeRef) && + recordService.isRecord(actionedUponNodeRef) && + !recordService.isDeclared(actionedUponNodeRef)) { result = true; } diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/ApplyCustomTypeAction.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/ApplyCustomTypeAction.java index c9d78a3080..bbcdfd156f 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/ApplyCustomTypeAction.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/ApplyCustomTypeAction.java @@ -55,7 +55,7 @@ public class ApplyCustomTypeAction extends RMActionExecuterAbstractBase public void setCustomTypeAspect(String customTypeAspect) { - this.customTypeAspect = QName.createQName(customTypeAspect, getNamespaceService()); + this.customTypeAspect = QName.createQName(customTypeAspect, namespaceService); } /** @@ -69,11 +69,11 @@ public class ApplyCustomTypeAction extends RMActionExecuterAbstractBase logger.debug("Executing action [" + action.getActionDefinitionName() + "] on " + actionedUponNodeRef); } - if (getRecordService().isRecord(actionedUponNodeRef)) + if (recordService.isRecord(actionedUponNodeRef)) { // Apply the appropriate aspect and set the properties. Map aspectProps = getPropertyValues(action); - this.getNodeService().addAspect(actionedUponNodeRef, customTypeAspect, aspectProps); + this.nodeService.addAspect(actionedUponNodeRef, customTypeAspect, aspectProps); } else if (logger.isWarnEnabled()) { @@ -88,7 +88,7 @@ public class ApplyCustomTypeAction extends RMActionExecuterAbstractBase @Override protected final void addParameterDefinitions(List paramList) { - AspectDefinition aspectDef = getDictionaryService().getAspect(customTypeAspect); + AspectDefinition aspectDef = dictionaryService.getAspect(customTypeAspect); for (PropertyDefinition propDef : aspectDef.getProperties().values()) { QName propName = propDef.getName(); @@ -109,7 +109,7 @@ public class ApplyCustomTypeAction extends RMActionExecuterAbstractBase Map result = new HashMap(paramValues.size()); for (Map.Entry entry : paramValues.entrySet()) { - QName propQName = QName.createQName(entry.getKey(), this.getNamespaceService()); + QName propQName = QName.createQName(entry.getKey(), this.namespaceService); result.put(propQName, entry.getValue()); } @@ -122,7 +122,7 @@ public class ApplyCustomTypeAction extends RMActionExecuterAbstractBase // We can take these parameter definitions from the properties defined in the dod model. if (this.parameterDefinitions == null) { - AspectDefinition aspectDefinition = getDictionaryService().getAspect(customTypeAspect); + AspectDefinition aspectDefinition = dictionaryService.getAspect(customTypeAspect); if (aspectDefinition == null) { throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_CUSTOM_ASPECT_NOT_RECOGNISED, customTypeAspect)); @@ -134,7 +134,7 @@ public class ApplyCustomTypeAction extends RMActionExecuterAbstractBase for (Map.Entry entry : props.entrySet()) { - String paramName = entry.getKey().toPrefixString(getNamespaceService()); + String paramName = entry.getKey().toPrefixString(namespaceService); PropertyDefinition value = entry.getValue(); QName paramType = value.getDataType().getName(); boolean paramIsMandatory = value.isMandatory(); diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/BroadcastDispositionActionDefinitionUpdateAction.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/BroadcastDispositionActionDefinitionUpdateAction.java index fcd70bad1c..a1597f2e36 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/BroadcastDispositionActionDefinitionUpdateAction.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/BroadcastDispositionActionDefinitionUpdateAction.java @@ -69,7 +69,7 @@ public class BroadcastDispositionActionDefinitionUpdateAction extends RMActionEx @Override protected void executeImpl(Action action, NodeRef actionedUponNodeRef) { - if (!RecordsManagementModel.TYPE_DISPOSITION_ACTION_DEFINITION.equals(getNodeService().getType(actionedUponNodeRef))) + if (!RecordsManagementModel.TYPE_DISPOSITION_ACTION_DEFINITION.equals(nodeService.getType(actionedUponNodeRef))) { return; } @@ -77,14 +77,14 @@ public class BroadcastDispositionActionDefinitionUpdateAction extends RMActionEx List changedProps = (List)action.getParameterValue(CHANGED_PROPERTIES); // Navigate up the containment hierarchy to get the record category grandparent and schedule. - NodeRef dispositionScheduleNode = getNodeService().getPrimaryParent(actionedUponNodeRef).getParentRef(); - NodeRef rmContainer = getNodeService().getPrimaryParent(dispositionScheduleNode).getParentRef(); - DispositionSchedule dispositionSchedule = getDispositionService().getAssociatedDispositionSchedule(rmContainer); + NodeRef dispositionScheduleNode = nodeService.getPrimaryParent(actionedUponNodeRef).getParentRef(); + NodeRef rmContainer = nodeService.getPrimaryParent(dispositionScheduleNode).getParentRef(); + DispositionSchedule dispositionSchedule = dispositionService.getAssociatedDispositionSchedule(rmContainer); behaviourFilter.disableBehaviour(); try { - List disposableItems = getDispositionService().getDisposableItems(dispositionSchedule); + List disposableItems = dispositionService.getDisposableItems(dispositionSchedule); for (NodeRef disposableItem : disposableItems) { updateDisposableItem(dispositionSchedule, disposableItem, actionedUponNodeRef, changedProps); @@ -107,11 +107,11 @@ public class BroadcastDispositionActionDefinitionUpdateAction extends RMActionEx { // We need to check that this folder is under the management of the disposition schedule that // has been updated - DispositionSchedule itemDs = getDispositionService().getDispositionSchedule(disposableItem); + DispositionSchedule itemDs = dispositionService.getDispositionSchedule(disposableItem); if (itemDs != null && itemDs.getNodeRef().equals(ds.getNodeRef())) { - if (getNodeService().hasAspect(disposableItem, ASPECT_DISPOSITION_LIFECYCLE)) + if (nodeService.hasAspect(disposableItem, ASPECT_DISPOSITION_LIFECYCLE)) { // disposition lifecycle already exists for node so process changes processActionDefinitionChanges(dispositionActionDefinition, changedProps, disposableItem); @@ -119,7 +119,7 @@ public class BroadcastDispositionActionDefinitionUpdateAction extends RMActionEx else { // disposition lifecycle does not exist on the node so setup disposition - getDispositionService().updateNextDispositionAction(disposableItem); + dispositionService.updateNextDispositionAction(disposableItem); } // update rolled up search information @@ -134,14 +134,14 @@ public class BroadcastDispositionActionDefinitionUpdateAction extends RMActionEx */ private void rollupSearchProperties(NodeRef disposableItem) { - DispositionAction da = getDispositionService().getNextDispositionAction(disposableItem); + DispositionAction da = dispositionService.getNextDispositionAction(disposableItem); if (da != null) { - Map props = getNodeService().getProperties(disposableItem); + Map props = nodeService.getProperties(disposableItem); props.put(PROP_RS_DISPOSITION_ACTION_NAME, da.getName()); props.put(PROP_RS_DISPOSITION_ACTION_AS_OF, da.getAsOfDate()); - props.put(PROP_RS_DISPOSITION_EVENTS_ELIGIBLE, getNodeService().getProperty(da.getNodeRef(), PROP_DISPOSITION_EVENTS_ELIGIBLE)); + props.put(PROP_RS_DISPOSITION_EVENTS_ELIGIBLE, nodeService.getProperty(da.getNodeRef(), PROP_DISPOSITION_EVENTS_ELIGIBLE)); DispositionActionDefinition daDefinition = da.getDispositionActionDefinition(); Period period = daDefinition.getPeriod(); @@ -164,7 +164,7 @@ public class BroadcastDispositionActionDefinitionUpdateAction extends RMActionEx } props.put(PROP_RS_DISPOSITION_EVENTS, (Serializable)list); - getNodeService().setProperties(disposableItem, props); + nodeService.setProperties(disposableItem, props); } } @@ -180,7 +180,7 @@ public class BroadcastDispositionActionDefinitionUpdateAction extends RMActionEx { // check that the step being edited is the current step for the folder, // if not, the change has no effect on the current step so ignore - DispositionAction nextAction = getDispositionService().getNextDispositionAction(recordOrFolder); + DispositionAction nextAction = dispositionService.getNextDispositionAction(recordOrFolder); if (doesChangedStepAffectNextAction(dispositionActionDef, nextAction)) { // the change does effect the nextAction for this node @@ -197,8 +197,8 @@ public class BroadcastDispositionActionDefinitionUpdateAction extends RMActionEx if (changedProps.contains(PROP_DISPOSITION_ACTION_NAME)) { - String action = (String)getNodeService().getProperty(dispositionActionDef, PROP_DISPOSITION_ACTION_NAME); - getNodeService().setProperty(nextAction.getNodeRef(), PROP_DISPOSITION_ACTION, action); + String action = (String)nodeService.getProperty(dispositionActionDef, PROP_DISPOSITION_ACTION_NAME); + nodeService.setProperty(nextAction.getNodeRef(), PROP_DISPOSITION_ACTION, action); } } } @@ -240,7 +240,7 @@ public class BroadcastDispositionActionDefinitionUpdateAction extends RMActionEx private void persistPeriodChanges(NodeRef dispositionActionDef, DispositionAction nextAction) { Date newAsOfDate = null; - Period dispositionPeriod = (Period) getNodeService().getProperty(dispositionActionDef, PROP_DISPOSITION_PERIOD); + Period dispositionPeriod = (Period) nodeService.getProperty(dispositionActionDef, PROP_DISPOSITION_PERIOD); if (dispositionPeriod != null) { @@ -255,7 +255,7 @@ public class BroadcastDispositionActionDefinitionUpdateAction extends RMActionEx "' (" + nextAction.getNodeRef() + ") to: " + newAsOfDate); } - getNodeService().setProperty(nextAction.getNodeRef(), PROP_DISPOSITION_AS_OF, newAsOfDate); + nodeService.setProperty(nextAction.getNodeRef(), PROP_DISPOSITION_AS_OF, newAsOfDate); } @Override diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/CloseRecordFolderAction.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/CloseRecordFolderAction.java index b53e55fd4c..561ecb5b32 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/CloseRecordFolderAction.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/CloseRecordFolderAction.java @@ -49,7 +49,7 @@ public class CloseRecordFolderAction extends RMActionExecuterAbstractBase @Override public Void doWork() { - getRecordFolderService().closeRecordFolder(actionedUponNodeRef); + recordFolderService.closeRecordFolder(actionedUponNodeRef); return null; } @@ -69,9 +69,9 @@ public class CloseRecordFolderAction extends RMActionExecuterAbstractBase private boolean eligibleForAction(NodeRef actionedUponNodeRef) { boolean result = false; - if (getNodeService().exists(actionedUponNodeRef) && - !getFreezeService().isFrozen(actionedUponNodeRef) && - !TYPE_UNFILED_RECORD_FOLDER.equals(getNodeService().getType(actionedUponNodeRef))) + if (nodeService.exists(actionedUponNodeRef) && + !freezeService.isFrozen(actionedUponNodeRef) && + !TYPE_UNFILED_RECORD_FOLDER.equals(nodeService.getType(actionedUponNodeRef))) { result = true; } diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/CompleteEventAction.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/CompleteEventAction.java index 97c31045bd..e4c81799d7 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/CompleteEventAction.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/CompleteEventAction.java @@ -39,7 +39,7 @@ public class CompleteEventAction extends RMActionExecuterAbstractBase { /** action name */ public static final String NAME = "completeEvent"; - + /** action parameter names */ public static final String PARAM_EVENT_NAME = "eventName"; public static final String PARAM_EVENT_COMPLETED_BY = "eventCompletedBy"; @@ -51,11 +51,11 @@ public class CompleteEventAction extends RMActionExecuterAbstractBase @Override protected void addParameterDefinitions(List paramList) { - paramList.add(new ParameterDefinitionImpl(PARAM_EVENT_NAME, - DataTypeDefinition.TEXT, + paramList.add(new ParameterDefinitionImpl(PARAM_EVENT_NAME, + DataTypeDefinition.TEXT, true, - getParamDisplayLabel(PARAM_EVENT_NAME), - false, + getParamDisplayLabel(PARAM_EVENT_NAME), + false, "rm-ac-manual-events")); } @@ -66,18 +66,18 @@ public class CompleteEventAction extends RMActionExecuterAbstractBase @Override protected void executeImpl(Action action, NodeRef actionedUponNodeRef) { - if (getNodeService().exists(actionedUponNodeRef) && - !getFreezeService().isFrozen(actionedUponNodeRef)) + if (nodeService.exists(actionedUponNodeRef) && + !freezeService.isFrozen(actionedUponNodeRef)) { /** get parameter values */ String eventName = (String)action.getParameterValue(PARAM_EVENT_NAME); String eventCompletedBy = (String)action.getParameterValue(PARAM_EVENT_COMPLETED_BY); Date eventCompletedAt = (Date)action.getParameterValue(PARAM_EVENT_COMPLETED_AT); - if (this.getNodeService().hasAspect(actionedUponNodeRef, ASPECT_DISPOSITION_LIFECYCLE)) + if (this.nodeService.hasAspect(actionedUponNodeRef, ASPECT_DISPOSITION_LIFECYCLE)) { // Get the next disposition action - DispositionAction da = this.getDispositionService().getNextDispositionAction(actionedUponNodeRef); + DispositionAction da = this.dispositionService.getNextDispositionAction(actionedUponNodeRef); if (da != null) { // complete event diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/CopyMoveLinkFileToBaseAction.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/CopyMoveLinkFileToBaseAction.java index b879c733a0..55fb6adf81 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/CopyMoveLinkFileToBaseAction.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/CopyMoveLinkFileToBaseAction.java @@ -108,7 +108,7 @@ public abstract class CopyMoveLinkFileToBaseAction extends RMActionExecuterAbstr String actionName = action.getActionDefinitionName(); if (isOkToProceedWithAction(actionedUponNodeRef, actionName)) { - QName actionedUponType = getNodeService().getType(actionedUponNodeRef); + QName actionedUponType = nodeService.getType(actionedUponNodeRef); boolean targetIsUnfiledRecords; if (ACTION_FILETO.equals(action.getActionDefinitionName())) @@ -117,7 +117,7 @@ public abstract class CopyMoveLinkFileToBaseAction extends RMActionExecuterAbstr } else { - targetIsUnfiledRecords = (getDictionaryService().isSubClass(actionedUponType, ContentModel.TYPE_CONTENT) && !getRecordService().isFiled(actionedUponNodeRef)) + targetIsUnfiledRecords = (dictionaryService.isSubClass(actionedUponType, ContentModel.TYPE_CONTENT) && !recordService.isFiled(actionedUponNodeRef)) || TYPE_UNFILED_RECORD_FOLDER.equals(actionedUponType); } @@ -150,7 +150,7 @@ public abstract class CopyMoveLinkFileToBaseAction extends RMActionExecuterAbstr } else if(getMode() == CopyMoveLinkFileToActionMode.LINK) { - getRecordService().link(actionedUponNodeRef, finalRecordFolder); + recordService.link(actionedUponNodeRef, finalRecordFolder); } } catch (FileNotFoundException fileNotFound) @@ -178,13 +178,13 @@ public abstract class CopyMoveLinkFileToBaseAction extends RMActionExecuterAbstr { // Check that the incoming parameters are valid prior to performing any action boolean okToProceed = false; - if(getNodeService().exists(actionedUponNodeRef) && !getFreezeService().isFrozen(actionedUponNodeRef)) + if(nodeService.exists(actionedUponNodeRef) && !freezeService.isFrozen(actionedUponNodeRef)) { - QName actionedUponType = getNodeService().getType(actionedUponNodeRef); + QName actionedUponType = nodeService.getType(actionedUponNodeRef); if(ACTION_FILETO.equals(actionName)) { // file to action can only be performed on unfiled records - okToProceed = !getRecordService().isFiled(actionedUponNodeRef) && getDictionaryService().isSubClass(actionedUponType, ContentModel.TYPE_CONTENT); + okToProceed = !recordService.isFiled(actionedUponNodeRef) && dictionaryService.isSubClass(actionedUponType, ContentModel.TYPE_CONTENT); if(!okToProceed && logger.isDebugEnabled()) { logger.debug("Unable to run " + actionName + " action on a node that isn't unfiled and a sub-class of content type"); @@ -193,7 +193,7 @@ public abstract class CopyMoveLinkFileToBaseAction extends RMActionExecuterAbstr else if(ACTION_LINKTO.equals(actionName)) { // link to action can only be performed on filed records - okToProceed = getRecordService().isFiled(actionedUponNodeRef) && getDictionaryService().isSubClass(actionedUponType, ContentModel.TYPE_CONTENT); + okToProceed = recordService.isFiled(actionedUponNodeRef) && dictionaryService.isSubClass(actionedUponType, ContentModel.TYPE_CONTENT); if(!okToProceed && logger.isDebugEnabled()) { logger.debug("Unable to run " + actionName + " action on a node that isn't filed and a sub-class of content type"); @@ -217,7 +217,7 @@ public abstract class CopyMoveLinkFileToBaseAction extends RMActionExecuterAbstr */ private void validateActionPostPathResolution(NodeRef actionedUponNodeRef, NodeRef target, String actionName, boolean targetIsUnfiledRecords) { - QName actionedUponType = getNodeService().getType(actionedUponNodeRef); + QName actionedUponType = nodeService.getType(actionedUponNodeRef); // now we have the reference to the target folder we can do some final checks to see if the action is valid if (target == null) { @@ -225,7 +225,7 @@ public abstract class CopyMoveLinkFileToBaseAction extends RMActionExecuterAbstr } if(targetIsUnfiledRecords) { - QName targetFolderType = getNodeService().getType(target); + QName targetFolderType = nodeService.getType(target); if(!TYPE_UNFILED_RECORD_CONTAINER.equals(targetFolderType) && !TYPE_UNFILED_RECORD_FOLDER.equals(targetFolderType)) { throw new AlfrescoRuntimeException("Unable to run " + actionName + " action, because the destination record folder is an inappropriate type."); @@ -233,11 +233,11 @@ public abstract class CopyMoveLinkFileToBaseAction extends RMActionExecuterAbstr } else { - if(getRecordFolderService().isRecordFolder(target) && !getDictionaryService().isSubClass(actionedUponType, ContentModel.TYPE_CONTENT) && (getRecordFolderService().isRecordFolder(actionedUponNodeRef) || filePlanService.isRecordCategory(actionedUponNodeRef))) + if(recordFolderService.isRecordFolder(target) && !dictionaryService.isSubClass(actionedUponType, ContentModel.TYPE_CONTENT) && (recordFolderService.isRecordFolder(actionedUponNodeRef) || filePlanService.isRecordCategory(actionedUponNodeRef))) { throw new AlfrescoRuntimeException("Unable to run " + actionName + " action, because the destination record folder is an inappropriate type. A record folder cannot contain another folder or a category"); } - else if(filePlanService.isRecordCategory(target) && getDictionaryService().isSubClass(actionedUponType, ContentModel.TYPE_CONTENT)) + else if(filePlanService.isRecordCategory(target) && dictionaryService.isSubClass(actionedUponType, ContentModel.TYPE_CONTENT)) { throw new AlfrescoRuntimeException("Unable to run " + actionName + " action, because the destination record folder is an inappropriate type. A record category cannot contain a record"); } @@ -299,7 +299,7 @@ public abstract class CopyMoveLinkFileToBaseAction extends RMActionExecuterAbstr if(create) { creating = true; - boolean lastAsFolder = lastPathElement && (getDictionaryService().isSubClass(getNodeService().getType(actionedUponNodeRef), ContentModel.TYPE_CONTENT) || RecordsManagementModel.TYPE_NON_ELECTRONIC_DOCUMENT.equals(getNodeService().getType(actionedUponNodeRef))); + boolean lastAsFolder = lastPathElement && (dictionaryService.isSubClass(nodeService.getType(actionedUponNodeRef), ContentModel.TYPE_CONTENT) || RecordsManagementModel.TYPE_NON_ELECTRONIC_DOCUMENT.equals(nodeService.getType(actionedUponNodeRef))); nodeRef = createChild(action, parent, childName, targetisUnfiledRecords, lastAsFolder); } else @@ -309,7 +309,7 @@ public abstract class CopyMoveLinkFileToBaseAction extends RMActionExecuterAbstr } else { - QName nodeType = getNodeService().getType(nodeRef); + QName nodeType = nodeService.getType(nodeRef); if(nodeType.equals(RecordsManagementModel.TYPE_HOLD_CONTAINER) || nodeType.equals(RecordsManagementModel.TYPE_TRANSFER_CONTAINER) || nodeType.equals(RecordsManagementModel.TYPE_UNFILED_RECORD_CONTAINER)) @@ -334,11 +334,10 @@ public abstract class CopyMoveLinkFileToBaseAction extends RMActionExecuterAbstr private NodeRef getChild(NodeRef parent, String childName) { NodeRef child = null; - List children = getNodeService().getChildAssocs(parent); - for (ChildAssociationRef childAssoc : children) - { + List children = nodeService.getChildAssocs(parent); + for (ChildAssociationRef childAssoc : children) { NodeRef childNodeRef = childAssoc.getChildRef(); - String existingChildName = (String)getNodeService().getProperty(childNodeRef, ContentModel.PROP_NAME); + String existingChildName = (String)nodeService.getProperty(childNodeRef, ContentModel.PROP_NAME); if(existingChildName.equals(childName)) { child = childNodeRef; @@ -372,11 +371,11 @@ public abstract class CopyMoveLinkFileToBaseAction extends RMActionExecuterAbstr } else if(lastAsFolder) { - child = getRecordFolderService().createRecordFolder(parent, childName); + child = recordFolderService.createRecordFolder(parent, childName); } else { - if(RecordsManagementModel.TYPE_RECORD_FOLDER.equals(getNodeService().getType(parent))) + if(RecordsManagementModel.TYPE_RECORD_FOLDER.equals(nodeService.getType(parent))) { throw new AlfrescoRuntimeException("Unable to execute " + action.getActionDefinitionName() + " action, because the destination path could not be created."); } @@ -398,11 +397,11 @@ public abstract class CopyMoveLinkFileToBaseAction extends RMActionExecuterAbstr private NodeRef getContext(Action action, NodeRef actionedUponNodeRef, boolean targetisUnfiledRecords) { NodeRef context = filePlanService.getFilePlan(actionedUponNodeRef); - if(targetisUnfiledRecords && (context != null) && getNodeService().exists(context)) + if(targetisUnfiledRecords && (context != null) && nodeService.exists(context)) { context = filePlanService.getUnfiledContainer(context); } - if((context == null) || (!getNodeService().exists(context))) + if((context == null) || (!nodeService.exists(context))) { throw new AlfrescoRuntimeException("Unable to execute " + action.getActionDefinitionName() + " action, because the path resolution context could not be determined."); } diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/CreateDispositionScheduleAction.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/CreateDispositionScheduleAction.java index f04f0c77ff..c3551c9cb0 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/CreateDispositionScheduleAction.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/CreateDispositionScheduleAction.java @@ -55,7 +55,7 @@ public class CreateDispositionScheduleAction extends RMActionExecuterAbstractBas if (eligibleForAction(actionedUponNodeRef)) { // Create the disposition schedule - getDispositionService().createDispositionSchedule(actionedUponNodeRef, null); + dispositionService.createDispositionSchedule(actionedUponNodeRef, null); } else { @@ -75,7 +75,7 @@ public class CreateDispositionScheduleAction extends RMActionExecuterAbstractBas private boolean eligibleForAction(NodeRef actionedUponNodeRef) { boolean result = false; - if (getNodeService().exists(actionedUponNodeRef) && + if (nodeService.exists(actionedUponNodeRef) && filePlanService.isRecordCategory(actionedUponNodeRef)) { result = true; diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/CutOffAction.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/CutOffAction.java index 09b35c9b71..1c542990d7 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/CutOffAction.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/CutOffAction.java @@ -42,7 +42,7 @@ public class CutOffAction extends RMDispositionActionExecuterAbstractBase if(checkUncutOffStatus(action, recordFolder)) { // Mark the folder as cut off - getDispositionService().cutoffDisposableItem(recordFolder); + dispositionService.cutoffDisposableItem(recordFolder); } } @@ -55,7 +55,7 @@ public class CutOffAction extends RMDispositionActionExecuterAbstractBase if(checkUncutOffStatus(action, record)) { // Mark the record as cut off - getDispositionService().cutoffDisposableItem(record); + dispositionService.cutoffDisposableItem(record); } } @@ -71,7 +71,7 @@ public class CutOffAction extends RMDispositionActionExecuterAbstractBase private boolean checkUncutOffStatus(Action action, NodeRef recordOrFolder) { boolean okToCutOff = true; - if(getNodeService().hasAspect(recordOrFolder, ASPECT_UNCUT_OFF)) + if(nodeService.hasAspect(recordOrFolder, ASPECT_UNCUT_OFF)) { if(action.getParameterValue(PARAM_NO_ERROR_CHECK) != null) { @@ -81,7 +81,7 @@ public class CutOffAction extends RMDispositionActionExecuterAbstractBase } else { - getNodeService().removeAspect(recordOrFolder, ASPECT_UNCUT_OFF); + nodeService.removeAspect(recordOrFolder, ASPECT_UNCUT_OFF); } } return okToCutOff; diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/DeclareRecordAction.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/DeclareRecordAction.java index 1d946695fb..82369c4613 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/DeclareRecordAction.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/DeclareRecordAction.java @@ -54,6 +54,17 @@ public class DeclareRecordAction extends RMActionExecuterAbstractBase /** Logger */ private static Log logger = LogFactory.getLog(DeclareRecordAction.class); + + /** check mandatory properties */ + private boolean checkMandatoryPropertiesEnabled = true; + + /** + * @param checkMandatoryPropertiesEnabled true if check mandatory properties is enabled, false otherwise + */ + public void setCheckMandatoryPropertiesEnabled(boolean checkMandatoryPropertiesEnabled) + { + this.checkMandatoryPropertiesEnabled = checkMandatoryPropertiesEnabled; + } /** * @see org.alfresco.repo.action.executer.ActionExecuterAbstractBase#executeImpl(org.alfresco.service.cmr.action.Action, org.alfresco.service.cmr.repository.NodeRef) @@ -61,24 +72,25 @@ public class DeclareRecordAction extends RMActionExecuterAbstractBase @Override protected void executeImpl(final Action action, final NodeRef actionedUponNodeRef) { - if (getNodeService().exists(actionedUponNodeRef) && - getRecordService().isRecord(actionedUponNodeRef) && - !getFreezeService().isFrozen(actionedUponNodeRef)) + if (nodeService.exists(actionedUponNodeRef) && + recordService.isRecord(actionedUponNodeRef) && + !freezeService.isFrozen(actionedUponNodeRef)) { - if (!getRecordService().isDeclared(actionedUponNodeRef)) + if (!recordService.isDeclared(actionedUponNodeRef)) { List missingProperties = new ArrayList(5); // Aspect not already defined - check mandatory properties then add - if (mandatoryPropertiesSet(actionedUponNodeRef, missingProperties)) + if (!checkMandatoryPropertiesEnabled || + mandatoryPropertiesSet(actionedUponNodeRef, missingProperties)) { - getRecordService().disablePropertyEditableCheck(); + recordService.disablePropertyEditableCheck(); try { // Add the declared aspect Map declaredProps = new HashMap(2); declaredProps.put(PROP_DECLARED_AT, new Date()); declaredProps.put(PROP_DECLARED_BY, AuthenticationUtil.getRunAsUser()); - this.getNodeService().addAspect(actionedUponNodeRef, ASPECT_DECLARED_RECORD, declaredProps); + this.nodeService.addAspect(actionedUponNodeRef, ASPECT_DECLARED_RECORD, declaredProps); AuthenticationUtil.runAsSystem(new RunAsWork() { @@ -86,14 +98,14 @@ public class DeclareRecordAction extends RMActionExecuterAbstractBase public Void doWork() { // remove all owner related rights - getOwnableService().setOwner(actionedUponNodeRef, OwnableService.NO_OWNER); + ownableService.setOwner(actionedUponNodeRef, OwnableService.NO_OWNER); return null; } }); } finally { - getRecordService().enablePropertyEditableCheck(); + recordService.enablePropertyEditableCheck(); } } else @@ -134,11 +146,11 @@ public class DeclareRecordAction extends RMActionExecuterAbstractBase { boolean result = true; - Map nodeRefProps = this.getNodeService().getProperties(nodeRef); + Map nodeRefProps = this.nodeService.getProperties(nodeRef); - QName nodeRefType = this.getNodeService().getType(nodeRef); + QName nodeRefType = this.nodeService.getType(nodeRef); - TypeDefinition typeDef = this.getDictionaryService().getType(nodeRefType); + TypeDefinition typeDef = this.dictionaryService.getType(nodeRefType); for (PropertyDefinition propDef : typeDef.getProperties().values()) { if (propDef.isMandatory() && nodeRefProps.get(propDef.getName()) == null) @@ -152,10 +164,10 @@ public class DeclareRecordAction extends RMActionExecuterAbstractBase if (result) { - Set aspects = this.getNodeService().getAspects(nodeRef); + Set aspects = this.nodeService.getAspects(nodeRef); for (QName aspect : aspects) { - AspectDefinition aspectDef = this.getDictionaryService().getAspect(aspect); + AspectDefinition aspectDef = this.dictionaryService.getAspect(aspect); for (PropertyDefinition propDef : aspectDef.getProperties().values()) { if (propDef.isMandatory() && nodeRefProps.get(propDef.getName()) == null) diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/DelegateAction.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/DelegateAction.java index efa55760e1..22bd3b2f86 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/DelegateAction.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/DelegateAction.java @@ -64,8 +64,8 @@ public class DelegateAction extends RMActionExecuterAbstractBase @Override protected void executeImpl(Action action, NodeRef actionedUponNodeRef) { - if (getNodeService().exists(actionedUponNodeRef) && - (!checkFrozen || !getFreezeService().isFrozen(actionedUponNodeRef))) + if (nodeService.exists(actionedUponNodeRef) && + (!checkFrozen || !freezeService.isFrozen(actionedUponNodeRef))) { // do the property subs (if any exist) if (isAllowParameterSubstitutions()) diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/DeleteHoldAction.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/DeleteHoldAction.java index d06c792991..e8f52ab40b 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/DeleteHoldAction.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/DeleteHoldAction.java @@ -41,9 +41,9 @@ public class DeleteHoldAction extends RMActionExecuterAbstractBase @Override protected void executeImpl(Action action, NodeRef actionedUponNodeRef) { - if (getHoldService().isHold(actionedUponNodeRef)) + if (holdService.isHold(actionedUponNodeRef)) { - getHoldService().deleteHold(actionedUponNodeRef); + holdService.deleteHold(actionedUponNodeRef); } else { diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/DestroyAction.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/DestroyAction.java index 27b0805122..cad671872d 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/DestroyAction.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/DestroyAction.java @@ -121,18 +121,18 @@ public class DestroyAction extends RMDispositionActionExecuterAbstractBase @Override protected void executeRecordFolderLevelDisposition(Action action, NodeRef recordFolder) { - List records = getRecordService().getRecords(recordFolder); + List records = recordService.getRecords(recordFolder); for (NodeRef record : records) { executeRecordLevelDisposition(action, record); } if (isGhostOnDestroySetForAction(action, recordFolder)) { - getNodeService().addAspect(recordFolder, ASPECT_GHOSTED, Collections. emptyMap()); + nodeService.addAspect(recordFolder, ASPECT_GHOSTED, Collections. emptyMap()); } else { - getNodeService().deleteNode(recordFolder); + nodeService.deleteNode(recordFolder); } } @@ -151,12 +151,12 @@ public class DestroyAction extends RMDispositionActionExecuterAbstractBase if (isGhostOnDestroySetForAction(action, record)) { // Add the ghosted aspect - getNodeService().addAspect(record, ASPECT_GHOSTED, null); + nodeService.addAspect(record, ASPECT_GHOSTED, null); } else { // If ghosting is not enabled, delete the node - getNodeService().deleteNode(record); + nodeService.deleteNode(record); } } @@ -167,15 +167,15 @@ public class DestroyAction extends RMDispositionActionExecuterAbstractBase */ private void clearAllContent(NodeRef nodeRef) { - Set props = this.getNodeService().getProperties(nodeRef).keySet(); - props.retainAll(this.getDictionaryService().getAllProperties(DataTypeDefinition.CONTENT)); + Set props = this.nodeService.getProperties(nodeRef).keySet(); + props.retainAll(this.dictionaryService.getAllProperties(DataTypeDefinition.CONTENT)); for (QName prop : props) { // Clear the content clearContent(nodeRef, prop); // Remove the property - this.getNodeService().removeProperty(nodeRef, prop); + this.nodeService.removeProperty(nodeRef, prop); } } @@ -196,19 +196,19 @@ public class DestroyAction extends RMDispositionActionExecuterAbstractBase // We want to remove the rn:renditioned aspect, but due to the possibility // that there is Alfresco 3.2-era data with the cm:thumbnailed aspect // applied, we must consider removing it too. - if (getNodeService().hasAspect(nodeRef, RenditionModel.ASPECT_RENDITIONED) || - getNodeService().hasAspect(nodeRef, ContentModel.ASPECT_THUMBNAILED)) + if (nodeService.hasAspect(nodeRef, RenditionModel.ASPECT_RENDITIONED) || + nodeService.hasAspect(nodeRef, ContentModel.ASPECT_THUMBNAILED)) { // Add the ghosted aspect to all the renditioned children, so that they will not be archived when the // renditioned aspect is removed - Set childAssocTypes = getDictionaryService().getAspect(RenditionModel.ASPECT_RENDITIONED).getChildAssociations().keySet(); - for (ChildAssociationRef child : getNodeService().getChildAssocs(nodeRef)) + Set childAssocTypes = dictionaryService.getAspect(RenditionModel.ASPECT_RENDITIONED).getChildAssociations().keySet(); + for (ChildAssociationRef child : nodeService.getChildAssocs(nodeRef)) { if (childAssocTypes.contains(child.getTypeQName())) { // Clear the content and delete the rendition clearAllContent(child.getChildRef()); - getNodeService().deleteNode(child.getChildRef()); + nodeService.deleteNode(child.getChildRef()); } } } @@ -223,7 +223,7 @@ public class DestroyAction extends RMDispositionActionExecuterAbstractBase private void clearContent(NodeRef nodeRef, QName contentProperty) { // Ensure the content is cleaned at the end of the transaction - ContentData contentData = (ContentData)getNodeService().getProperty(nodeRef, contentProperty); + ContentData contentData = (ContentData)nodeService.getProperty(nodeRef, contentProperty); if (contentData != null && contentData.getContentUrl() != null) { eagerContentStoreCleaner.registerOrphanedContentUrl(contentData.getContentUrl(), true); @@ -233,7 +233,7 @@ public class DestroyAction extends RMDispositionActionExecuterAbstractBase /** * Return true if the ghost on destroy property is set against the * definition for the passed action on the specified node - * + * * @param action * @param nodeRef * @return @@ -244,7 +244,7 @@ public class DestroyAction extends RMDispositionActionExecuterAbstractBase String actionDefinitionName = action.getActionDefinitionName(); if (!StringUtils.isEmpty(actionDefinitionName)) { - DispositionSchedule dispositionSchedule = this.getDispositionService().getDispositionSchedule(nodeRef); + DispositionSchedule dispositionSchedule = this.dispositionService.getDispositionSchedule(nodeRef); if (dispositionSchedule != null) { DispositionActionDefinition actionDefinition = dispositionSchedule diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/EditDispositionActionAsOfDateAction.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/EditDispositionActionAsOfDateAction.java index 2e9badd71f..e17427ff46 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/EditDispositionActionAsOfDateAction.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/EditDispositionActionAsOfDateAction.java @@ -48,7 +48,7 @@ public class EditDispositionActionAsOfDateAction extends RMActionExecuterAbstrac @Override protected void executeImpl(Action action, NodeRef actionedUponNodeRef) { - if (this.getNodeService().hasAspect(actionedUponNodeRef, ASPECT_DISPOSITION_LIFECYCLE)) + if (this.nodeService.hasAspect(actionedUponNodeRef, ASPECT_DISPOSITION_LIFECYCLE)) { // Get the action parameter Date asOfDate = (Date)action.getParameterValue(PARAM_AS_OF_DATE); @@ -58,10 +58,10 @@ public class EditDispositionActionAsOfDateAction extends RMActionExecuterAbstrac } // Set the dispostion action as of date - DispositionAction da = getDispositionService().getNextDispositionAction(actionedUponNodeRef); + DispositionAction da = dispositionService.getNextDispositionAction(actionedUponNodeRef); if (da != null) { - getNodeService().setProperty(da.getNodeRef(), PROP_DISPOSITION_AS_OF, asOfDate); + nodeService.setProperty(da.getNodeRef(), PROP_DISPOSITION_AS_OF, asOfDate); } } else diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/EditHoldReasonAction.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/EditHoldReasonAction.java index 786cf4ffac..02402acff6 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/EditHoldReasonAction.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/EditHoldReasonAction.java @@ -27,7 +27,7 @@ import org.springframework.extensions.surf.util.I18NUtil; /** * Edit freeze reason Action - * + * * @author Roy Wetherall */ public class EditHoldReasonAction extends RMActionExecuterAbstractBase @@ -45,7 +45,7 @@ public class EditHoldReasonAction extends RMActionExecuterAbstractBase @Override protected void executeImpl(Action action, NodeRef actionedUponNodeRef) { - if (getFreezeService().isHold(actionedUponNodeRef)) + if (freezeService.isHold(actionedUponNodeRef)) { // Get the property values String reason = (String) action.getParameterValue(PARAM_REASON); @@ -55,7 +55,7 @@ public class EditHoldReasonAction extends RMActionExecuterAbstractBase } // Update hold reason - getFreezeService().updateReason(actionedUponNodeRef, reason); + freezeService.updateReason(actionedUponNodeRef, reason); } else { diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/EditReviewAsOfDateAction.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/EditReviewAsOfDateAction.java index 6c91a5087e..694a08d142 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/EditReviewAsOfDateAction.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/EditReviewAsOfDateAction.java @@ -47,8 +47,8 @@ public class EditReviewAsOfDateAction extends RMActionExecuterAbstractBase @Override protected void executeImpl(Action action, NodeRef actionedUponNodeRef) { - if (getRecordService().isRecord(actionedUponNodeRef) && - getNodeService().hasAspect(actionedUponNodeRef, ASPECT_VITAL_RECORD)) + if (recordService.isRecord(actionedUponNodeRef) && + nodeService.hasAspect(actionedUponNodeRef, ASPECT_VITAL_RECORD)) { // Get the action parameter Date reviewAsOf = (Date)action.getParameterValue(PARAM_AS_OF_DATE); @@ -58,7 +58,7 @@ public class EditReviewAsOfDateAction extends RMActionExecuterAbstractBase } // Set the as of date - this.getNodeService().setProperty(actionedUponNodeRef, PROP_REVIEW_AS_OF, reviewAsOf); + this.nodeService.setProperty(actionedUponNodeRef, PROP_REVIEW_AS_OF, reviewAsOf); } else diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/FileReportAction.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/FileReportAction.java index ce74c1dbb7..4859a9280b 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/FileReportAction.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/FileReportAction.java @@ -132,7 +132,7 @@ public class FileReportAction extends RMActionExecuterAbstractBase implements Re }); // return the report name - String filedReportName = (String) getNodeService().getProperty(filedReport, ContentModel.PROP_NAME); + String filedReportName = (String) nodeService.getProperty(filedReport, ContentModel.PROP_NAME); action.setParameterValue(ActionExecuterAbstractBase.PARAM_RESULT, filedReportName); } @@ -145,7 +145,7 @@ public class FileReportAction extends RMActionExecuterAbstractBase implements Re { if (AccessStatus.DENIED.equals(capabilityService.getCapability("FillingPermissionOnly").hasPermission(nodeRef))) { - throw new AlfrescoRuntimeException("You don't have filing permission on the destination or the destination is either frozen, closed or cut off!"); + throw new AlfrescoRuntimeException("The destination is either frozen, closed or cut off!"); } } @@ -186,6 +186,6 @@ public class FileReportAction extends RMActionExecuterAbstractBase implements Re private QName getReportType(Action action) { String reportType = getParameterValue(action, REPORT_TYPE); - return QName.createQName(reportType, getNamespaceService()); + return QName.createQName(reportType, namespaceService); } } diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/FreezeAction.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/FreezeAction.java index dc21f4ec54..bb44ad8ba3 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/FreezeAction.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/FreezeAction.java @@ -55,13 +55,13 @@ public class FreezeAction extends RMActionExecuterAbstractBase protected void executeImpl(Action action, NodeRef actionedUponNodeRef) { // NOTE: we can only freeze records and record folders so ignore everything else - if (getNodeService().exists(actionedUponNodeRef) && - !getNodeService().hasAspect(actionedUponNodeRef, ContentModel.ASPECT_PENDING_DELETE) && - (getRecordService().isRecord(actionedUponNodeRef) || - getRecordFolderService().isRecordFolder(actionedUponNodeRef)) && - !getFreezeService().isFrozen(actionedUponNodeRef)) + if (nodeService.exists(actionedUponNodeRef) && + !nodeService.hasAspect(actionedUponNodeRef, ContentModel.ASPECT_PENDING_DELETE) && + (recordService.isRecord(actionedUponNodeRef) || + recordFolderService.isRecordFolder(actionedUponNodeRef)) && + !freezeService.isFrozen(actionedUponNodeRef)) { - getFreezeService().freeze((String) action.getParameterValue(PARAM_REASON), actionedUponNodeRef); + freezeService.freeze((String) action.getParameterValue(PARAM_REASON), actionedUponNodeRef); } } } \ No newline at end of file diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/OpenRecordFolderAction.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/OpenRecordFolderAction.java index 481e609b2a..bf0f3e6bd1 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/OpenRecordFolderAction.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/OpenRecordFolderAction.java @@ -50,28 +50,28 @@ public class OpenRecordFolderAction extends RMActionExecuterAbstractBase @Override protected void executeImpl(Action action, NodeRef actionedUponNodeRef) { - if (getNodeService().exists(actionedUponNodeRef) && - !getFreezeService().isFrozen(actionedUponNodeRef) && - !(getDictionaryService().isSubClass(getNodeService().getType(actionedUponNodeRef), ContentModel.TYPE_CONTENT) && !getRecordService().isFiled(actionedUponNodeRef))) + if (nodeService.exists(actionedUponNodeRef) && + !freezeService.isFrozen(actionedUponNodeRef) && + !(dictionaryService.isSubClass(nodeService.getType(actionedUponNodeRef), ContentModel.TYPE_CONTENT) && !recordService.isFiled(actionedUponNodeRef))) { // TODO move re-open logic into a service method // TODO check that the user in question has the correct permission to re-open a records folder - if (getRecordService().isRecord(actionedUponNodeRef)) + if (recordService.isRecord(actionedUponNodeRef)) { - ChildAssociationRef assocRef = getNodeService().getPrimaryParent(actionedUponNodeRef); + ChildAssociationRef assocRef = nodeService.getPrimaryParent(actionedUponNodeRef); if (assocRef != null) { actionedUponNodeRef = assocRef.getParentRef(); } } - if (getRecordFolderService().isRecordFolder(actionedUponNodeRef)) + if (recordFolderService.isRecordFolder(actionedUponNodeRef)) { - Boolean isClosed = (Boolean) getNodeService().getProperty(actionedUponNodeRef, PROP_IS_CLOSED); + Boolean isClosed = (Boolean) nodeService.getProperty(actionedUponNodeRef, PROP_IS_CLOSED); if (Boolean.TRUE.equals(isClosed)) { - getNodeService().setProperty(actionedUponNodeRef, PROP_IS_CLOSED, false); + nodeService.setProperty(actionedUponNodeRef, PROP_IS_CLOSED, false); } } else diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/RejectAction.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/RejectAction.java index 47a54503bd..4c3314f6f7 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/RejectAction.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/RejectAction.java @@ -47,11 +47,11 @@ public class RejectAction extends RMActionExecuterAbstractBase @Override protected void executeImpl(Action action, NodeRef actionedUponNodeRef) { - if (getNodeService().exists(actionedUponNodeRef) && - !getFreezeService().isFrozen(actionedUponNodeRef) && - getNodeService().getProperty(actionedUponNodeRef, PROP_RECORD_ORIGINATING_LOCATION) != null) + if (nodeService.exists(actionedUponNodeRef) && + !freezeService.isFrozen(actionedUponNodeRef) && + nodeService.getProperty(actionedUponNodeRef, PROP_RECORD_ORIGINATING_LOCATION) != null) { - getRecordService().rejectRecord(actionedUponNodeRef, (String) action.getParameterValue(PARAM_REASON)); + recordService.rejectRecord(actionedUponNodeRef, (String) action.getParameterValue(PARAM_REASON)); } } diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/RelinquishHoldAction.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/RelinquishHoldAction.java index cbf320a50e..f0fd5ce1e6 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/RelinquishHoldAction.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/RelinquishHoldAction.java @@ -26,7 +26,7 @@ import org.springframework.extensions.surf.util.I18NUtil; /** * Relinquish Hold Action - * + * * @author Roy Wetherall */ public class RelinquishHoldAction extends RMActionExecuterAbstractBase @@ -41,9 +41,9 @@ public class RelinquishHoldAction extends RMActionExecuterAbstractBase @Override protected void executeImpl(Action action, NodeRef actionedUponNodeRef) { - if (getFreezeService().isHold(actionedUponNodeRef)) + if (freezeService.isHold(actionedUponNodeRef)) { - getFreezeService().relinquish(actionedUponNodeRef); + freezeService.relinquish(actionedUponNodeRef); } else { diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/RequestInfoAction.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/RequestInfoAction.java index 925eceeb5e..99a689198a 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/RequestInfoAction.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/RequestInfoAction.java @@ -36,7 +36,7 @@ import org.alfresco.service.cmr.repository.NodeRef; import org.alfresco.service.cmr.workflow.WorkflowService; import org.alfresco.service.namespace.QName; import org.alfresco.workflow.RMWorkflowModel; -import org.apache.commons.lang.StringUtils; +import org.apache.axis.utils.StringUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -79,10 +79,10 @@ public class RequestInfoAction extends RMActionExecuterAbstractBase @Override protected void executeImpl(Action action, NodeRef actionedUponNodeRef) { - if (getNodeService().exists(actionedUponNodeRef) && - !getNodeService().hasAspect(actionedUponNodeRef, ContentModel.ASPECT_PENDING_DELETE) && - getRecordService().isRecord(actionedUponNodeRef) && - !getRecordService().isDeclared(actionedUponNodeRef)) + if (nodeService.exists(actionedUponNodeRef) && + !nodeService.hasAspect(actionedUponNodeRef, ContentModel.ASPECT_PENDING_DELETE) && + recordService.isRecord(actionedUponNodeRef) && + !recordService.isDeclared(actionedUponNodeRef)) { String workflowDefinitionId = workflowService.getDefinitionByName(REQUEST_INFO_WORKFLOW_DEFINITION_NAME).getId(); Map parameters = new HashMap(); @@ -120,10 +120,10 @@ public class RequestInfoAction extends RMActionExecuterAbstractBase */ private NodeRef getWorkflowPackage(Action action, NodeRef actionedUponNodeRef) { - NodeRef workflowPackage = (NodeRef) action.getParameterValue(WorkflowModel.ASSOC_PACKAGE.toPrefixString(getNamespaceService())); + NodeRef workflowPackage = (NodeRef) action.getParameterValue(WorkflowModel.ASSOC_PACKAGE.toPrefixString(namespaceService)); workflowPackage = workflowService.createPackage(workflowPackage); - ChildAssociationRef childAssoc = getNodeService().getPrimaryParent(actionedUponNodeRef); - getNodeService().addChild(workflowPackage, actionedUponNodeRef, WorkflowModel.ASSOC_PACKAGE_CONTAINS, childAssoc.getQName()); + ChildAssociationRef childAssoc = nodeService.getPrimaryParent(actionedUponNodeRef); + nodeService.addChild(workflowPackage, actionedUponNodeRef, WorkflowModel.ASSOC_PACKAGE_CONTAINS, childAssoc.getQName()); return workflowPackage; } diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/SplitEmailAction.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/SplitEmailAction.java index 8a25b62c0c..f585c68b5d 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/SplitEmailAction.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/SplitEmailAction.java @@ -18,8 +18,6 @@ */ package org.alfresco.module.org_alfresco_module_rm.action.impl; -import static org.apache.commons.lang.StringUtils.isBlank; - import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; @@ -28,7 +26,6 @@ import java.io.UnsupportedEncodingException; import java.util.HashMap; import java.util.List; import java.util.Map; -import java.util.Set; import javax.mail.MessagingException; import javax.mail.Multipart; @@ -41,12 +38,10 @@ import org.alfresco.error.AlfrescoRuntimeException; import org.alfresco.model.ContentModel; import org.alfresco.model.ImapModel; import org.alfresco.module.org_alfresco_module_rm.action.RMActionExecuterAbstractBase; -import org.alfresco.module.org_alfresco_module_rm.relationship.RelationshipDefinition; -import org.alfresco.module.org_alfresco_module_rm.relationship.RelationshipDisplayName; -import org.alfresco.module.org_alfresco_module_rm.relationship.RelationshipService; import org.alfresco.repo.security.authentication.AuthenticationUtil; import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork; import org.alfresco.service.cmr.action.Action; +import org.alfresco.service.cmr.dictionary.AssociationDefinition; import org.alfresco.service.cmr.repository.AssociationRef; import org.alfresco.service.cmr.repository.ChildAssociationRef; import org.alfresco.service.cmr.repository.ContentReader; @@ -80,52 +75,25 @@ public class SplitEmailAction extends RMActionExecuterAbstractBase /** Logger */ private static Log logger = LogFactory.getLog(SplitEmailAction.class); - /** Relationship service */ - private RelationshipService relationshipService; - - /** - * Gets the relationship service instance - * - * @return The relationship service instance - */ - protected RelationshipService getRelationshipService() - { - return this.relationshipService; - } - - /** - * Sets the relationship service instance - * - * @param relationshipService The relationship service instance - */ - public void setRelationshipService(RelationshipService relationshipService) - { - this.relationshipService = relationshipService; - } - - /** Unique name of the relationship definition */ - private String relationshipUniqueName; + private QName relationshipQName; public void bootstrap() { - Set relationshipDefinitions = getRelationshipService().getRelationshipDefinitions(); - for (RelationshipDefinition relationshipDefinition : relationshipDefinitions) - { - RelationshipDisplayName displayName = relationshipDefinition.getDisplayName(); - String sourceText = displayName.getSourceText(); - String targetText = displayName.getTargetText(); + String compoundId = recordsManagementAdminService.getCompoundIdFor(REL_FROM, REL_TO); - if (sourceText.equals(REL_FROM) && targetText.equals(REL_TO)) + Map map = recordsManagementAdminService.getCustomReferenceDefinitions(); + for (Map.Entry entry : map.entrySet()) + { + if (compoundId.equals(entry.getValue().getTitle(dictionaryService))) { - relationshipUniqueName = relationshipDefinition.getUniqueName(); + relationshipQName = entry.getKey(); + break; } } - if (isBlank(relationshipUniqueName)) + if (relationshipQName == null) { - RelationshipDisplayName displayName = new RelationshipDisplayName(REL_FROM, REL_TO); - RelationshipDefinition relationshipDefinition = getRelationshipService().createRelationshipDefinition(displayName); - relationshipUniqueName = relationshipDefinition.getUniqueName(); + relationshipQName = recordsManagementAdminService.addCustomChildAssocDefinition(REL_FROM, REL_TO); } } @@ -137,23 +105,23 @@ public class SplitEmailAction extends RMActionExecuterAbstractBase protected void executeImpl(Action action, NodeRef actionedUponNodeRef) { // get node type - getNodeService().getType(actionedUponNodeRef); + nodeService.getType(actionedUponNodeRef); if (logger.isDebugEnabled()) { logger.debug("split email:" + actionedUponNodeRef); } - if (getRecordService().isRecord(actionedUponNodeRef)) + if (recordService.isRecord(actionedUponNodeRef)) { - if (!getRecordService().isDeclared(actionedUponNodeRef)) + if (!recordService.isDeclared(actionedUponNodeRef)) { - ChildAssociationRef parent = getNodeService().getPrimaryParent(actionedUponNodeRef); + ChildAssociationRef parent = nodeService.getPrimaryParent(actionedUponNodeRef); /** * Check whether the email message has already been split - do nothing if it has already been split */ - List refs = getNodeService().getTargetAssocs(actionedUponNodeRef, ImapModel.ASSOC_IMAP_ATTACHMENT); + List refs = nodeService.getTargetAssocs(actionedUponNodeRef, ImapModel.ASSOC_IMAP_ATTACHMENT); if(refs.size() > 0) { if (logger.isDebugEnabled()) @@ -168,7 +136,7 @@ public class SplitEmailAction extends RMActionExecuterAbstractBase */ try { - ContentReader reader = getContentService().getReader(actionedUponNodeRef, ContentModel.PROP_CONTENT); + ContentReader reader = contentService.getReader(actionedUponNodeRef, ContentModel.PROP_CONTENT); InputStream is = reader.getContentInputStream(); MimeMessage mimeMessage = new MimeMessage(null, is); Object content = mimeMessage.getContent(); @@ -225,7 +193,7 @@ public class SplitEmailAction extends RMActionExecuterAbstractBase } } - Map messageProperties = getNodeService().getProperties(messageNodeRef); + Map messageProperties = nodeService.getProperties(messageNodeRef); String messageTitle = (String)messageProperties.get(ContentModel.PROP_NAME); if(messageTitle == null) { @@ -245,7 +213,7 @@ public class SplitEmailAction extends RMActionExecuterAbstractBase /** * Create an attachment node in the same folder as the message */ - ChildAssociationRef attachmentRef = getNodeService().createNode(parentNodeRef, + ChildAssociationRef attachmentRef = nodeService.createNode(parentNodeRef, ContentModel.ASSOC_CONTAINS, QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, fileName), ContentModel.TYPE_CONTENT, @@ -254,7 +222,7 @@ public class SplitEmailAction extends RMActionExecuterAbstractBase /** * Write the content into the new attachment node */ - ContentWriter writer = getContentService().getWriter(attachmentRef.getChildRef(), ContentModel.PROP_CONTENT, true); + ContentWriter writer = contentService.getWriter(attachmentRef.getChildRef(), ContentModel.PROP_CONTENT, true); writer.setMimetype(contentType.getBaseType()); OutputStream os = writer.getContentOutputStream(); FileCopyUtils.copy(part.getInputStream(), os); @@ -278,10 +246,10 @@ public class SplitEmailAction extends RMActionExecuterAbstractBase public Void doWork() { // add the relationship - getRelationshipService().addRelationship(relationshipUniqueName, parentRef, childRef); + recordsManagementAdminService.addCustomReference(parentRef, childRef, relationshipQName); // add the IMAP attachment aspect - getNodeService().createAssociation( + nodeService.createAssociation( parentRef, childRef, ImapModel.ASSOC_IMAP_ATTACHMENT); diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/TransferAction.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/TransferAction.java index 3c02ba59fe..dbaba86616 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/TransferAction.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/TransferAction.java @@ -101,9 +101,9 @@ public class TransferAction extends RMDispositionActionExecuterAbstractBase action.setParameterValue(ActionExecuter.PARAM_RESULT, transferNodeRef); // Cut off the disposable item if it's not cut off already - if (!getDispositionService().isDisposableItemCutoff(dispositionLifeCycleNodeRef)) + if (!dispositionService.isDisposableItemCutoff(dispositionLifeCycleNodeRef)) { - getDispositionService().cutoffDisposableItem(dispositionLifeCycleNodeRef); + dispositionService.cutoffDisposableItem(dispositionLifeCycleNodeRef); } } } diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/TransferCompleteAction.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/TransferCompleteAction.java index 527175bc81..679786b3fd 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/TransferCompleteAction.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/TransferCompleteAction.java @@ -36,9 +36,6 @@ public class TransferCompleteAction extends RMActionExecuterAbstractBase /** I18N */ private static final String MSG_NODE_NOT_TRANSFER = "rm.action.node-not-transfer"; - /** Action name */ - public static final String NAME = "transferComplete"; - /** Transfer service */ private TransferService transferService; @@ -76,8 +73,8 @@ public class TransferCompleteAction extends RMActionExecuterAbstractBase */ private void checkTransferSubClass(NodeRef actionedUponNodeRef) { - QName type = getNodeService().getType(actionedUponNodeRef); - if (!getDictionaryService().isSubClass(type, TYPE_TRANSFER)) + QName type = nodeService.getType(actionedUponNodeRef); + if (!dictionaryService.isSubClass(type, TYPE_TRANSFER)) { throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_NODE_NOT_TRANSFER)); } diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/UnCutoffAction.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/UnCutoffAction.java index f60db31934..d0efeba546 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/UnCutoffAction.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/UnCutoffAction.java @@ -43,11 +43,11 @@ public class UnCutoffAction extends RMActionExecuterAbstractBase @Override protected void executeImpl(Action action, NodeRef actionedUponNodeRef) { - if (getNodeService().hasAspect(actionedUponNodeRef, ASPECT_DISPOSITION_LIFECYCLE) && - getNodeService().hasAspect(actionedUponNodeRef, ASPECT_CUT_OFF)) + if (nodeService.hasAspect(actionedUponNodeRef, ASPECT_DISPOSITION_LIFECYCLE) && + nodeService.hasAspect(actionedUponNodeRef, ASPECT_CUT_OFF)) { // Get the last disposition action - DispositionAction da = getDispositionService().getLastCompletedDispostionAction(actionedUponNodeRef); + DispositionAction da = dispositionService.getLastCompletedDispostionAction(actionedUponNodeRef); // Check that the last disposition action was a cutoff if (da == null || !da.getName().equals("cutoff")) @@ -57,33 +57,33 @@ public class UnCutoffAction extends RMActionExecuterAbstractBase } // Remove the cutoff aspect and add the uncutoff aspect - getNodeService().removeAspect(actionedUponNodeRef, ASPECT_CUT_OFF); - getNodeService().addAspect(actionedUponNodeRef, ASPECT_UNCUT_OFF, null); - if (getRecordFolderService().isRecordFolder(actionedUponNodeRef)) + nodeService.removeAspect(actionedUponNodeRef, ASPECT_CUT_OFF); + nodeService.addAspect(actionedUponNodeRef, ASPECT_UNCUT_OFF, null); + if (recordFolderService.isRecordFolder(actionedUponNodeRef)) { - List records = getRecordService().getRecords(actionedUponNodeRef); + List records = recordService.getRecords(actionedUponNodeRef); for (NodeRef record : records) { - getNodeService().removeAspect(record, ASPECT_CUT_OFF); - getNodeService().addAspect(record, ASPECT_UNCUT_OFF, null); + nodeService.removeAspect(record, ASPECT_CUT_OFF); + nodeService.addAspect(record, ASPECT_UNCUT_OFF, null); } } // Delete the current disposition action - DispositionAction currentDa = getDispositionService().getNextDispositionAction(actionedUponNodeRef); + DispositionAction currentDa = dispositionService.getNextDispositionAction(actionedUponNodeRef); if (currentDa != null) { - getNodeService().deleteNode(currentDa.getNodeRef()); + nodeService.deleteNode(currentDa.getNodeRef()); } // Move the previous (cutoff) disposition back to be current - getNodeService().moveNode(da.getNodeRef(), actionedUponNodeRef, ASSOC_NEXT_DISPOSITION_ACTION, ASSOC_NEXT_DISPOSITION_ACTION); + nodeService.moveNode(da.getNodeRef(), actionedUponNodeRef, ASSOC_NEXT_DISPOSITION_ACTION, ASSOC_NEXT_DISPOSITION_ACTION); // Reset the started and completed property values - getNodeService().setProperty(da.getNodeRef(), PROP_DISPOSITION_ACTION_STARTED_AT, null); - getNodeService().setProperty(da.getNodeRef(), PROP_DISPOSITION_ACTION_STARTED_BY, null); - getNodeService().setProperty(da.getNodeRef(), PROP_DISPOSITION_ACTION_COMPLETED_AT, null); - getNodeService().setProperty(da.getNodeRef(), PROP_DISPOSITION_ACTION_COMPLETED_BY, null); + nodeService.setProperty(da.getNodeRef(), PROP_DISPOSITION_ACTION_STARTED_AT, null); + nodeService.setProperty(da.getNodeRef(), PROP_DISPOSITION_ACTION_STARTED_BY, null); + nodeService.setProperty(da.getNodeRef(), PROP_DISPOSITION_ACTION_COMPLETED_AT, null); + nodeService.setProperty(da.getNodeRef(), PROP_DISPOSITION_ACTION_COMPLETED_BY, null); } } } \ No newline at end of file diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/UndeclareRecordAction.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/UndeclareRecordAction.java index 9c5aba4ea3..5bb9408f25 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/UndeclareRecordAction.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/UndeclareRecordAction.java @@ -44,16 +44,16 @@ public class UndeclareRecordAction extends RMActionExecuterAbstractBase @Override protected void executeImpl(Action action, NodeRef actionedUponNodeRef) { - if (getNodeService().exists(actionedUponNodeRef)) + if (nodeService.exists(actionedUponNodeRef)) { - if (getRecordService().isRecord(actionedUponNodeRef)) + if (recordService.isRecord(actionedUponNodeRef)) { // repoen if already complete and not frozen - if (getRecordService().isDeclared(actionedUponNodeRef) && - !getFreezeService().isFrozen(actionedUponNodeRef)) + if (recordService.isDeclared(actionedUponNodeRef) && + !freezeService.isFrozen(actionedUponNodeRef)) { // Remove the declared aspect - this.getNodeService().removeAspect(actionedUponNodeRef, ASPECT_DECLARED_RECORD); + this.nodeService.removeAspect(actionedUponNodeRef, ASPECT_DECLARED_RECORD); } } else diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/UndoEventAction.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/UndoEventAction.java index e27f4589e0..655e27443f 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/UndoEventAction.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/UndoEventAction.java @@ -45,10 +45,10 @@ public class UndoEventAction extends RMActionExecuterAbstractBase { String eventName = (String)action.getParameterValue(PARAM_EVENT_NAME); - if (this.getNodeService().hasAspect(actionedUponNodeRef, ASPECT_DISPOSITION_LIFECYCLE)) + if (this.nodeService.hasAspect(actionedUponNodeRef, ASPECT_DISPOSITION_LIFECYCLE)) { // Get the next disposition action - DispositionAction da = this.getDispositionService().getNextDispositionAction(actionedUponNodeRef); + DispositionAction da = this.dispositionService.getNextDispositionAction(actionedUponNodeRef); if (da != null) { // undo completed event diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/UnfreezeAction.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/UnfreezeAction.java index a69c4478be..779e08e5a3 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/UnfreezeAction.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/UnfreezeAction.java @@ -24,7 +24,7 @@ import org.alfresco.service.cmr.repository.NodeRef; /** * Unfreeze Action - * + * * @author Roy Wetherall */ public class UnfreezeAction extends RMActionExecuterAbstractBase @@ -36,6 +36,6 @@ public class UnfreezeAction extends RMActionExecuterAbstractBase @Override protected void executeImpl(Action action, NodeRef actionedUponNodeRef) { - getFreezeService().unFreeze(actionedUponNodeRef); + freezeService.unFreeze(actionedUponNodeRef); } } \ No newline at end of file diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/UnlinkFromAction.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/UnlinkFromAction.java deleted file mode 100644 index 91e492ad19..0000000000 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/action/impl/UnlinkFromAction.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright (C) 2005-2014 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - */ -package org.alfresco.module.org_alfresco_module_rm.action.impl; - -import org.alfresco.error.AlfrescoRuntimeException; -import org.alfresco.model.ContentModel; -import org.alfresco.module.org_alfresco_module_rm.action.RMActionExecuterAbstractBase; -import org.alfresco.service.cmr.action.Action; -import org.alfresco.service.cmr.repository.NodeRef; - -/** - * Unlink from action implementation. - * - * @author Roy Wetherall - * @since 2.3 - */ -public class UnlinkFromAction extends RMActionExecuterAbstractBase -{ - /** action name */ - public static final String NAME = "unlinkFrom"; - - /** action parameters */ - public static final String PARAM_RECORD_FOLDER = "recordFolder"; - - /** - * @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) - { - // check that the actioned upon node reference exists and is of the correct type - if (getNodeService().exists(actionedUponNodeRef) && - !getNodeService().hasAspect(actionedUponNodeRef, ContentModel.ASPECT_PENDING_DELETE) && - getRecordService().isRecord(actionedUponNodeRef)) - { - // get the record folder we are unlinking from - String recordFolderValue = (String)action.getParameterValue(PARAM_RECORD_FOLDER); - if (recordFolderValue == null || recordFolderValue.isEmpty()) - { - // indicate that the record folder is mandatory - throw new AlfrescoRuntimeException("Can't unlink, because no record folder was provided."); - } - NodeRef recordFolder = new NodeRef(recordFolderValue); - - // unlink record from record folder - getRecordService().unlink(actionedUponNodeRef, recordFolder); - } - } -} \ No newline at end of file diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/admin/RecordsManagementAdminBase.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/admin/RecordsManagementAdminBase.java deleted file mode 100644 index 32a0c37f5c..0000000000 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/admin/RecordsManagementAdminBase.java +++ /dev/null @@ -1,376 +0,0 @@ -/* - * Copyright (C) 2005-2014 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - */ -package org.alfresco.module.org_alfresco_module_rm.admin; - -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.io.UnsupportedEncodingException; -import java.util.Collection; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.alfresco.error.AlfrescoRuntimeException; -import org.alfresco.model.ContentModel; -import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementCustomModel; -import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; -import org.alfresco.repo.content.MimetypeMap; -import org.alfresco.repo.dictionary.DictionaryRepositoryBootstrap; -import org.alfresco.repo.dictionary.M2Model; -import org.alfresco.repo.dictionary.M2Namespace; -import org.alfresco.service.cmr.dictionary.AspectDefinition; -import org.alfresco.service.cmr.dictionary.AssociationDefinition; -import org.alfresco.service.cmr.dictionary.DictionaryException; -import org.alfresco.service.cmr.dictionary.DictionaryService; -import org.alfresco.service.cmr.repository.ContentReader; -import org.alfresco.service.cmr.repository.ContentService; -import org.alfresco.service.cmr.repository.ContentWriter; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.repository.NodeService; -import org.alfresco.service.cmr.repository.StoreRef; -import org.alfresco.service.namespace.NamespaceService; -import org.alfresco.service.namespace.QName; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.springframework.extensions.surf.util.I18NUtil; - -/** - * Base class for RM admin services - * - * @author Tuna Aksoy - * @since 2.3 - */ -public class RecordsManagementAdminBase implements RecordsManagementCustomModel -{ - /** Logger */ - protected Log logger = LogFactory.getLog(this.getClass()); - - /** Constants */ - private static final String SOURCE_TARGET_ID_SEPARATOR = "__"; - private static final NodeRef RM_CUSTOM_MODEL_NODE_REF = new NodeRef(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, "records_management_custom_model"); - - /** I18N */ - private static final String MSG_CUSTOM_MODEL_NOT_FOUND = "rm.admin.custom-model-not-found"; - private static final String MSG_CUSTOM_MODEL_NO_CONTENT = "rm.admin.custom-model-no-content"; - private static final String MSG_ERROR_WRITE_CUSTOM_MODEL = "rm.admin.error-write-custom-model"; - private static final String MSG_ERROR_SPLIT_ID = "rm.admin.error-split-id"; - - /** Dictionary service */ - private DictionaryService dictionaryService; - - /** Node service */ - private NodeService nodeService; - - /** Content service */ - private ContentService contentService; - - /** Namespace service */ - private NamespaceService namespaceService; - - /** Dictionary repository bootstrap */ - private DictionaryRepositoryBootstrap dictionaryRepositoryBootstrap; - - /** - * Gets the dictionary service instance - * - * @return The dictionary service instance - */ - protected DictionaryService getDictionaryService() - { - return this.dictionaryService; - } - - /** - * Gets the node service instance - * - * @return The node service instance - */ - protected NodeService getNodeService() - { - return this.nodeService; - } - - /** - * Gets the content service instance - * - * @return The content service instance - */ - protected ContentService getContentService() - { - return this.contentService; - } - - /** - * Gets the namespace service instance - * - * @return The namespace service instance - */ - protected NamespaceService getNamespaceService() - { - return this.namespaceService; - } - - /** - * Gets the dictionary repository bootstrap instance - * - * @return The dictionary repository bootstrap instance - */ - protected DictionaryRepositoryBootstrap getDictionaryRepositoryBootstrap() - { - return this.dictionaryRepositoryBootstrap; - } - - /** - * Sets the dictionary service instance - * - * @param dictionaryService The dictionary service instance - */ - public void setDictionaryService(DictionaryService dictionaryService) - { - this.dictionaryService = dictionaryService; - } - - /** - * Sets the node service instance - * - * @param nodeService The node service instance - */ - public void setNodeService(NodeService nodeService) - { - this.nodeService = nodeService; - } - - /** - * Sets the content service instance - * - * @param contentService The content service instance - */ - public void setContentService(ContentService contentService) - { - this.contentService = contentService; - } - - /** - * Sets the namespace service instance - * - * @param namespaceService The namespace service instance - */ - public void setNamespaceService(NamespaceService namespaceService) - { - this.namespaceService = namespaceService; - } - - /** - * Sets the dictionary repository bootstrap instance - * - * @param dictionaryRepositoryBootstrap The dictionary repository bootstrap instance - */ - public void setDictionaryRepositoryBootstrap(DictionaryRepositoryBootstrap dictionaryRepositoryBootstrap) - { - this.dictionaryRepositoryBootstrap = dictionaryRepositoryBootstrap; - } - - /** - * Gets all the custom associations - * - * @return All custom associations - */ - protected Map getCustomAssociations() - { - Map customAssociations = new HashMap(); - - AspectDefinition aspectDefn = getDictionaryService().getAspect(ASPECT_CUSTOM_ASSOCIATIONS); - if (aspectDefn != null) - { - customAssociations.putAll(aspectDefn.getAssociations()); - } - - return customAssociations; - } - - /** - * Gets the node reference of the custom model - * - * @param uri The URI of the model namespace - * @return The node reference of the custom model - */ - protected NodeRef getCustomModelRef(String uri) - { - if ((uri.equals("")) || (uri.equals(RecordsManagementModel.RM_CUSTOM_URI))) - { - // note: short-cut for "rmc" currently assumes that RM custom model does not define additional namespaces - return RM_CUSTOM_MODEL_NODE_REF; - } - else - { - // ALF-5875 - List modelRefs = getDictionaryRepositoryBootstrap().getModelRefs(); - - for (NodeRef modelRef : modelRefs) - { - try - { - M2Model model = readCustomContentModel(modelRef); - - for (M2Namespace namespace : model.getNamespaces()) - { - if (namespace.getUri().equals(uri)) - { - return modelRef; - } - } - } - catch (DictionaryException de) - { - logger.warn("readCustomContentModel: skip model ("+modelRef+") whilst searching for uri ("+uri+"): ", de); - } - } - - throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_CUSTOM_MODEL_NOT_FOUND, uri)); - } - } - - /** - * Gets the deserialized model - * - * @param modelNodeRef The node reference of the model - * @return The deserialized model - */ - protected M2Model readCustomContentModel(NodeRef modelNodeRef) - { - ContentReader reader = getContentService().getReader(modelNodeRef, ContentModel.TYPE_CONTENT); - if (!reader.exists()) - { - throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_CUSTOM_MODEL_NO_CONTENT, modelNodeRef.toString())); - } - - InputStream contentIn = null; - M2Model deserializedModel = null; - - try - { - contentIn = reader.getContentInputStream(); - deserializedModel = M2Model.createModel(contentIn); - } - finally - { - try - { - if (contentIn != null) - { - contentIn.close(); - } - } - catch (IOException ignored) - { - // Intentionally empty. - } - } - - return deserializedModel; - } - - /** - * Updates the content of the custom model - * - * @param modelRef The node reference of the model - * @param deserializedModel The deserialized model - */ - protected void writeCustomContentModel(NodeRef modelRef, M2Model deserializedModel) - { - ContentWriter writer = getContentService().getWriter(modelRef, ContentModel.TYPE_CONTENT, true); - writer.setMimetype(MimetypeMap.MIMETYPE_XML); - writer.setEncoding("UTF-8"); - - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - deserializedModel.toXML(baos); - - String updatedModelXml; - try - { - updatedModelXml = baos.toString("UTF-8"); - writer.putContent(updatedModelXml); - // putContent closes all resources. - // so we don't have to. - } - catch (UnsupportedEncodingException uex) - { - throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_ERROR_WRITE_CUSTOM_MODEL, modelRef.toString()), uex); - } - } - - /** - * Checks if the given association definition title exists - * - * @param associationDefinitionTitle The association definition title - * @return true if the association definition title exists, false otherwise - */ - protected boolean existsTitle(String associationDefinitionTitle) - { - boolean existsLabel = false; - Collection associationDefinitions = getCustomAssociations().values(); - for (AssociationDefinition associationDefinition : associationDefinitions) - { - if (associationDefinition.getTitle(getDictionaryService()).equalsIgnoreCase(associationDefinitionTitle)) - { - existsLabel = true; - } - } - return existsLabel; - } - - /** - * Splits the association definition title into source text and target text - * - * @param sourceTargetText The text to split into source text and target text - * @return Splited association definition title which includes source text and target text - */ - protected String[] splitAssociationDefinitionTitle(String sourceTargetText) - { - if (!sourceTargetText.contains(SOURCE_TARGET_ID_SEPARATOR)) - { - throw new IllegalArgumentException(I18NUtil.getMessage(MSG_ERROR_SPLIT_ID, sourceTargetText, SOURCE_TARGET_ID_SEPARATOR)); - } - - return sourceTargetText.split(SOURCE_TARGET_ID_SEPARATOR); - } - - /** - * Creates the association definition title form the source text and target text - * - * @param sourceText The source text - * @param targetText The target text - * @return The association definition title created from the source text and target text - */ - protected String composeAssociationDefinitionTitle(String sourceText, String targetText) - { - if (sourceText.contains(SOURCE_TARGET_ID_SEPARATOR)) - { - throw new IllegalArgumentException("sourceId cannot contain '" + SOURCE_TARGET_ID_SEPARATOR + "': " + sourceText); - } - - StringBuilder sb = new StringBuilder(); - sb.append(sourceText) - .append(SOURCE_TARGET_ID_SEPARATOR) - .append(targetText); - - return sb.toString(); - } -} diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/admin/RecordsManagementAdminService.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/admin/RecordsManagementAdminService.java index 63ea8da6c8..c91264641f 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/admin/RecordsManagementAdminService.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/admin/RecordsManagementAdminService.java @@ -24,16 +24,13 @@ import java.util.Set; import org.alfresco.error.AlfrescoRuntimeException; import org.alfresco.module.org_alfresco_module_rm.caveat.RMListOfValuesConstraint.MatchLogic; -import org.alfresco.module.org_alfresco_module_rm.relationship.RelationshipService; import org.alfresco.service.cmr.dictionary.AssociationDefinition; import org.alfresco.service.cmr.dictionary.ConstraintDefinition; import org.alfresco.service.cmr.dictionary.PropertyDefinition; import org.alfresco.service.cmr.repository.AssociationRef; import org.alfresco.service.cmr.repository.ChildAssociationRef; import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.repository.NodeService; import org.alfresco.service.namespace.QName; -import org.alfresco.service.namespace.RegexQNamePattern; /** * Records management custom model service interface. Implementations of this class are responsible @@ -234,7 +231,6 @@ public interface RecordsManagementAdminService * in the results. * * @return The Map of custom references (both parent-child and standard). - * @deprecated as of RM 2.3, please use {@link RelationshipService#getRelationshipDefinitions()} instead. */ Map getCustomReferenceDefinitions(); @@ -243,7 +239,6 @@ public interface RecordsManagementAdminService * * @param node the node from which the associations start. * @return a List of associations. - * @deprecated as of RM 2.3, please use {@link NodeService#getTargetAssocs(NodeRef, RegexQNamePattern.MATCH_ALL)} instead. */ List getCustomReferencesFrom(NodeRef node); @@ -253,7 +248,6 @@ public interface RecordsManagementAdminService * * @param node * @return - * @deprecated as of RM 2.3, please use {@link NodeService#getChildAssocs(NodeRef)} instead. */ List getCustomChildReferences(NodeRef node); @@ -262,7 +256,6 @@ public interface RecordsManagementAdminService * * @param node the node to which the associations point. * @return a List of associations. - * @deprecated as of RM 2.3, please use {@link NodeService#getSourceAssocs(NodeRef, RegexQNamePattern.MATCH_ALL)} instead. */ List getCustomReferencesTo(NodeRef node); @@ -271,7 +264,6 @@ public interface RecordsManagementAdminService * * @param node * @return - * @deprecated as of RM 2.3, please use {@link NodeService#getParentAssocs(NodeRef)} instead. */ List getCustomParentReferences(NodeRef node); @@ -285,7 +277,6 @@ public interface RecordsManagementAdminService * @param assocId the server-side qname e.g. {http://www.alfresco.org/model/rmcustom/1.0}abcd-12-efgh-4567 * @throws AlfrescoRuntimeException if an instance of the specified reference type * already exists from fromNode to toNode. - * @deprecated as of RM 2.3, please use {@link RelationshipService#addRelationship(String, NodeRef, NodeRef)} instead. */ void addCustomReference(NodeRef fromNode, NodeRef toNode, QName assocId); @@ -295,7 +286,6 @@ public interface RecordsManagementAdminService * @param fromNode * @param toNode * @param assocId the server-side qname e.g. {http://www.alfresco.org/model/rmcustom/1.0}abcd-12-efgh-4567 - * @deprecated as of RM 2.3, please use {@link RelationshipService#removeRelationship(String, NodeRef, NodeRef)} instead. */ void removeCustomReference(NodeRef fromNode, NodeRef toNode, QName assocId); @@ -304,7 +294,6 @@ public interface RecordsManagementAdminService * * @param label the title of the association definition * @return the QName of the newly-created association. - * @deprecated as of RM 2.3, please use {@link RelationshipService#createRelationshipDefinition(org.alfresco.module.org_alfresco_module_rm.relationship.RelationshipDisplayName)} instead. */ QName addCustomAssocDefinition(String label); @@ -315,7 +304,6 @@ public interface RecordsManagementAdminService * @param source * @param target * @return the QName of the newly-created association. - * @deprecated as of RM 2.3, please use {@link RelationshipService#createRelationshipDefinition(org.alfresco.module.org_alfresco_module_rm.relationship.RelationshipDisplayName)} instead. */ QName addCustomChildAssocDefinition(String source, String target); @@ -329,7 +317,6 @@ public interface RecordsManagementAdminService * @param newTarget the new value for the target field. * @see #getCompoundIdFor(String, String) * @see #splitSourceTargetId(String) - * @deprecated as of RM 2.3, please use {@link RelationshipService#updateRelationshipDefinition(String, org.alfresco.module.org_alfresco_module_rm.relationship.RelationshipDisplayName)} instead. */ QName updateCustomChildAssocDefinition(QName refQName, String newSource, String newTarget); @@ -340,7 +327,6 @@ public interface RecordsManagementAdminService * * @param refQName qname of the child association. * @param newLabel the new value for the label field. - * @deprecated as of RM 2.3, please use {@link RelationshipService#updateRelationshipDefinition(String, org.alfresco.module.org_alfresco_module_rm.relationship.RelationshipDisplayName)} instead. */ QName updateCustomAssocDefinition(QName refQName, String newLabel); diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/admin/RecordsManagementAdminServiceImpl.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/admin/RecordsManagementAdminServiceImpl.java index 2008fd8851..2a35b12038 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/admin/RecordsManagementAdminServiceImpl.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/admin/RecordsManagementAdminServiceImpl.java @@ -18,9 +18,10 @@ */ package org.alfresco.module.org_alfresco_module_rm.admin; -import static org.springframework.extensions.surf.util.ParameterCheck.mandatory; -import static org.springframework.extensions.surf.util.ParameterCheck.mandatoryString; - +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.UnsupportedEncodingException; import java.text.MessageFormat; import java.util.ArrayList; import java.util.Collection; @@ -32,21 +33,31 @@ import java.util.Set; import org.alfresco.error.AlfrescoRuntimeException; import org.alfresco.model.ContentModel; +import org.alfresco.module.org_alfresco_module_rm.RecordsManagementPolicies.BeforeCreateReference; +import org.alfresco.module.org_alfresco_module_rm.RecordsManagementPolicies.BeforeRemoveReference; +import org.alfresco.module.org_alfresco_module_rm.RecordsManagementPolicies.OnCreateReference; +import org.alfresco.module.org_alfresco_module_rm.RecordsManagementPolicies.OnRemoveReference; import org.alfresco.module.org_alfresco_module_rm.caveat.RMListOfValuesConstraint; import org.alfresco.module.org_alfresco_module_rm.caveat.RMListOfValuesConstraint.MatchLogic; import org.alfresco.module.org_alfresco_module_rm.compatibility.CompatibilityModel; import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementCustomModel; import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; -import org.alfresco.module.org_alfresco_module_rm.relationship.RelationshipDefinition; -import org.alfresco.module.org_alfresco_module_rm.relationship.RelationshipDisplayName; -import org.alfresco.module.org_alfresco_module_rm.relationship.RelationshipService; +import org.alfresco.module.org_alfresco_module_rm.util.PoliciesUtil; +import org.alfresco.repo.content.MimetypeMap; +import org.alfresco.repo.dictionary.DictionaryRepositoryBootstrap; import org.alfresco.repo.dictionary.IndexTokenisationMode; import org.alfresco.repo.dictionary.M2Aspect; +import org.alfresco.repo.dictionary.M2Association; +import org.alfresco.repo.dictionary.M2ChildAssociation; +import org.alfresco.repo.dictionary.M2ClassAssociation; import org.alfresco.repo.dictionary.M2Constraint; import org.alfresco.repo.dictionary.M2Model; +import org.alfresco.repo.dictionary.M2Namespace; import org.alfresco.repo.dictionary.M2Property; import org.alfresco.repo.node.NodeServicePolicies; import org.alfresco.repo.policy.Behaviour.NotificationFrequency; +import org.alfresco.repo.policy.ClassPolicyDelegate; +import org.alfresco.repo.policy.PolicyComponent; import org.alfresco.repo.policy.annotation.Behaviour; import org.alfresco.repo.policy.annotation.BehaviourBean; import org.alfresco.repo.policy.annotation.BehaviourKind; @@ -57,15 +68,26 @@ import org.alfresco.service.cmr.dictionary.AssociationDefinition; import org.alfresco.service.cmr.dictionary.Constraint; import org.alfresco.service.cmr.dictionary.ConstraintDefinition; import org.alfresco.service.cmr.dictionary.DataTypeDefinition; +import org.alfresco.service.cmr.dictionary.DictionaryException; +import org.alfresco.service.cmr.dictionary.DictionaryService; import org.alfresco.service.cmr.dictionary.PropertyDefinition; import org.alfresco.service.cmr.dictionary.TypeDefinition; import org.alfresco.service.cmr.repository.AssociationRef; import org.alfresco.service.cmr.repository.ChildAssociationRef; +import org.alfresco.service.cmr.repository.ContentReader; +import org.alfresco.service.cmr.repository.ContentService; +import org.alfresco.service.cmr.repository.ContentWriter; import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.cmr.repository.NodeService; +import org.alfresco.service.cmr.repository.StoreRef; +import org.alfresco.service.namespace.NamespaceService; import org.alfresco.service.namespace.QName; import org.alfresco.service.namespace.RegexQNamePattern; import org.alfresco.util.GUID; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import org.springframework.extensions.surf.util.I18NUtil; +import org.springframework.extensions.surf.util.ParameterCheck; import org.springframework.extensions.surf.util.URLDecoder; /** @@ -74,53 +96,197 @@ import org.springframework.extensions.surf.util.URLDecoder; * @author Neil McErlean, janv */ @BehaviourBean -public class RecordsManagementAdminServiceImpl extends RecordsManagementAdminBase implements RecordsManagementAdminService, - NodeServicePolicies.OnAddAspectPolicy, - NodeServicePolicies.OnRemoveAspectPolicy, - NodeServicePolicies.OnCreateNodePolicy +public class RecordsManagementAdminServiceImpl implements RecordsManagementAdminService, + RecordsManagementCustomModel, + NodeServicePolicies.OnAddAspectPolicy, + NodeServicePolicies.OnRemoveAspectPolicy, + NodeServicePolicies.OnCreateNodePolicy { + /** Logger */ + private static Log logger = LogFactory.getLog(RecordsManagementAdminServiceImpl.class); + /** I18N messages*/ private static final String MSG_SERVICE_NOT_INIT = "rm.admin.service-not-init"; private static final String MSG_PROP_EXIST = "rm.admin.prop-exist"; private static final String MSG_CUSTOM_PROP_EXIST = "rm.admin.custom-prop-exist"; private static final String MSG_UNKNOWN_ASPECT = "rm.admin.unknown-aspect"; + private static final String MSG_REF_EXIST = "rm.admin.ref-exist"; + private static final String MSG_REF_LABEL_IN_USE = "rm.admin.ref-label-in-use"; + private static final String MSG_ASSOC_EXISTS = "rm.admin.assoc-exists"; + private static final String MSG_CHILD_ASSOC_EXISTS = "rm.admin.child-assoc-exists"; + private static final String MSG_CONNOT_FIND_ASSOC_DEF = "rm.admin.cannot-find-assoc-def"; private static final String MSG_CONSTRAINT_EXISTS = "rm.admin.constraint-exists"; private static final String MSG_CANNOT_FIND_CONSTRAINT = "rm.admin.contraint-cannot-find"; private static final String MSG_UNEXPECTED_TYPE_CONSTRAINT = "rm.admin.unexpected_type_constraint"; + private static final String MSG_CUSTOM_MODEL_NOT_FOUND = "rm.admin.custom-model-not-found"; + private static final String MSG_CUSTOM_MODEL_NO_CONTENT = "rm.admin.custom-model-no-content"; + private static final String MSG_ERROR_WRITE_CUSTOM_MODEL = "rm.admin.error-write-custom-model"; private static final String MSG_ERROR_CLIENT_ID = "rm.admin.error-client-id"; + private static final String MSG_ERROR_SPLIT_ID = "rm.admin.error-split-id"; /** Constants */ + public static final String RMC_CUSTOM_ASSOCS = RecordsManagementCustomModel.RM_CUSTOM_PREFIX + ":customAssocs"; private static final String CUSTOM_CONSTRAINT_TYPE = org.alfresco.module.org_alfresco_module_rm.caveat.RMListOfValuesConstraint.class.getName(); private static final String CAPATIBILITY_CUSTOM_CONTRAINT_TYPE = org.alfresco.module.org_alfresco_module_dod5015.caveat.RMListOfValuesConstraint.class.getName(); + private static final NodeRef RM_CUSTOM_MODEL_NODE_REF = new NodeRef(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, "records_management_custom_model"); private static final String PARAM_ALLOWED_VALUES = "allowedValues"; private static final String PARAM_CASE_SENSITIVE = "caseSensitive"; private static final String PARAM_MATCH_LOGIC = "matchLogic"; + public static final String RMA_RECORD = "rma:record"; + private static final String SOURCE_TARGET_ID_SEPARATOR = "__"; - /** Relationship service */ - private RelationshipService relationshipService; + /** Dictionary service */ + private DictionaryService dictionaryService; + + /** Namespace service */ + private NamespaceService namespaceService; + + /** Node service */ + private NodeService nodeService; + + /** Content service */ + private ContentService contentService; + + /** Dictionary repository bootstrap */ + private DictionaryRepositoryBootstrap dictonaryRepositoryBootstrap; + + /** Policy component */ + private PolicyComponent policyComponent; + + /** Policy delegates */ + private ClassPolicyDelegate beforeCreateReferenceDelegate; + private ClassPolicyDelegate onCreateReferenceDelegate; + private ClassPolicyDelegate beforeRemoveReferenceDelegate; + private ClassPolicyDelegate onRemoveReferenceDelegate; /** List of types that can be customisable */ private List pendingCustomisableTypes; private Map customisableTypes; /** - * Sets the relationship instance - * - * @param relationshipService The relationship service instance + * @param dictionaryService the dictionary service */ - public void setRelationshipService(RelationshipService relationshipService) + public void setDictionaryService(DictionaryService dictionaryService) { - this.relationshipService = relationshipService; + this.dictionaryService = dictionaryService; + } + + /** + * @param namespaceService the namespace service + */ + public void setNamespaceService(NamespaceService namespaceService) + { + this.namespaceService = namespaceService; + } + + /** + * @param nodeService the node service + */ + public void setNodeService(NodeService nodeService) + { + this.nodeService = nodeService; + } + + /** + * @param contentService the content service + */ + public void setContentService(ContentService contentService) + { + this.contentService = contentService; + } + + /** + * @param policyComponent the policy component + */ + public void setPolicyComponent(PolicyComponent policyComponent) + { + this.policyComponent = policyComponent; } /** - * Gets the relationship service instance + * Bootstrap for standard (non-RMC) dynamic models * - * @return The relationship service instance + * @param dictonaryRepositoryBootstrap dictionary repository bootstrap */ - protected RelationshipService getRelationshipService() + public void setDictionaryRepositoryBootstrap(DictionaryRepositoryBootstrap dictonaryRepositoryBootstrap) { - return this.relationshipService; + this.dictonaryRepositoryBootstrap = dictonaryRepositoryBootstrap; + } + + /** + * Initialisation method + */ + public void init() + { + // Register the various policies + beforeCreateReferenceDelegate = policyComponent.registerClassPolicy(BeforeCreateReference.class); + onCreateReferenceDelegate = policyComponent.registerClassPolicy(OnCreateReference.class); + beforeRemoveReferenceDelegate = policyComponent.registerClassPolicy(BeforeRemoveReference.class); + onRemoveReferenceDelegate = policyComponent.registerClassPolicy(OnRemoveReference.class); + } + + /** + * Invoke before create reference policy + * + * @param fromNodeRef + * @param toNodeRef + * @param reference + */ + protected void invokeBeforeCreateReference(NodeRef fromNodeRef, NodeRef toNodeRef, QName reference) + { + // get qnames to invoke against + Set qnames = PoliciesUtil.getTypeAndAspectQNames(nodeService, fromNodeRef); + // execute policy for node type and aspects + BeforeCreateReference policy = beforeCreateReferenceDelegate.get(qnames); + policy.beforeCreateReference(fromNodeRef, toNodeRef, reference); + } + + /** + * Invoke on create reference policy + * + * @param fromNodeRef + * @param toNodeRef + * @param reference + */ + protected void invokeOnCreateReference(NodeRef fromNodeRef, NodeRef toNodeRef, QName reference) + { + // get qnames to invoke against + Set qnames = PoliciesUtil.getTypeAndAspectQNames(nodeService, fromNodeRef); + // execute policy for node type and aspects + OnCreateReference policy = onCreateReferenceDelegate.get(qnames); + policy.onCreateReference(fromNodeRef, toNodeRef, reference); + } + + /** + * Invoke before remove reference policy + * + * @param fromNodeRef + * @param toNodeRef + * @param reference + */ + protected void invokeBeforeRemoveReference(NodeRef fromNodeRef, NodeRef toNodeRef, QName reference) + { + // get qnames to invoke against + Set qnames = PoliciesUtil.getTypeAndAspectQNames(nodeService, fromNodeRef); + // execute policy for node type and aspects + BeforeRemoveReference policy = beforeRemoveReferenceDelegate.get(qnames); + policy.beforeRemoveReference(fromNodeRef, toNodeRef, reference); + } + + /** + * Invoke on remove reference policy + * + * @param fromNodeRef + * @param toNodeRef + * @param reference + */ + protected void invokeOnRemoveReference(NodeRef fromNodeRef, NodeRef toNodeRef, QName reference) + { + // get qnames to invoke against + Set qnames = PoliciesUtil.getTypeAndAspectQNames(nodeService, fromNodeRef); + // execute policy for node type and aspects + OnRemoveReference policy = onRemoveReferenceDelegate.get(qnames); + policy.onRemoveReference(fromNodeRef, toNodeRef, reference); } /** @@ -135,20 +301,17 @@ public class RecordsManagementAdminServiceImpl extends RecordsManagementAdminBas ) public void onAddAspect(final NodeRef nodeRef, final QName aspectTypeQName) { - mandatory("nodeRef", nodeRef); - mandatory("aspectTypeQName", aspectTypeQName); - AuthenticationUtil.runAs(new RunAsWork() { @Override public Void doWork() { - if (getNodeService().exists(nodeRef) && - getDictionaryService().getAllModels().contains(RM_CUSTOM_MODEL) && + if (nodeService.exists(nodeRef) && + dictionaryService.getAllModels().contains(RM_CUSTOM_MODEL) && isCustomisable(aspectTypeQName)) { QName customPropertyAspect = getCustomAspect(aspectTypeQName); - getNodeService().addAspect(nodeRef, customPropertyAspect, null); + nodeService.addAspect(nodeRef, customPropertyAspect, null); } return null; @@ -168,19 +331,16 @@ public class RecordsManagementAdminServiceImpl extends RecordsManagementAdminBas ) public void onRemoveAspect(final NodeRef nodeRef, final QName aspectTypeQName) { - mandatory("nodeRef", nodeRef); - mandatory("aspectTypeQName", aspectTypeQName); - AuthenticationUtil.runAs(new RunAsWork() { @Override public Void doWork() { - if (getNodeService().exists(nodeRef) && + if (nodeService.exists(nodeRef) && isCustomisable(aspectTypeQName)) { QName customPropertyAspect = getCustomAspect(aspectTypeQName); - getNodeService().removeAspect(nodeRef, customPropertyAspect); + nodeService.removeAspect(nodeRef, customPropertyAspect); } return null; @@ -202,26 +362,24 @@ public class RecordsManagementAdminServiceImpl extends RecordsManagementAdminBas ) public void onCreateNode(final ChildAssociationRef childAssocRef) { - mandatory("nodeRef", childAssocRef); - AuthenticationUtil.runAs(new RunAsWork() { @Override public Void doWork() { - if (getDictionaryService().getAllModels().contains(RecordsManagementCustomModel.RM_CUSTOM_MODEL)) + if (dictionaryService.getAllModels().contains(RecordsManagementCustomModel.RM_CUSTOM_MODEL)) { NodeRef nodeRef = childAssocRef.getChildRef(); - QName type = getNodeService().getType(nodeRef); + QName type = nodeService.getType(nodeRef); while (type != null && !ContentModel.TYPE_CMOBJECT.equals(type)) { if (isCustomisable(type)) { QName customPropertyAspect = getCustomAspect(type); - getNodeService().addAspect(nodeRef, customPropertyAspect, null); + nodeService.addAspect(nodeRef, customPropertyAspect, null); } - TypeDefinition def = getDictionaryService().getType(type); + TypeDefinition def = dictionaryService.getType(type); if (def != null) { type = def.getParentName(); @@ -252,13 +410,11 @@ public class RecordsManagementAdminServiceImpl extends RecordsManagementAdminBas */ public void setCustomisableTypes(List customisableTypes) { - mandatory("customisableTypes", customisableTypes); - - pendingCustomisableTypes = new ArrayList(); - for (String customisableType : customisableTypes) - { - pendingCustomisableTypes.add(QName.createQName(customisableType, getNamespaceService())); - } + pendingCustomisableTypes = new ArrayList(); + for (String customisableType : customisableTypes) + { + pendingCustomisableTypes.add(QName.createQName(customisableType, namespaceService)); + } } /** @@ -266,7 +422,7 @@ public class RecordsManagementAdminServiceImpl extends RecordsManagementAdminBas */ public Set getCustomisable() { - return getCustomisableMap().keySet(); + return getCustomisableMap().keySet(); } /** @@ -275,12 +431,10 @@ public class RecordsManagementAdminServiceImpl extends RecordsManagementAdminBas @Override public Set getCustomisable(NodeRef nodeRef) { - mandatory("nodeRef", nodeRef); - Set result = new HashSet(5); // Check the nodes hierarchy for customisable types - QName type = getNodeService().getType(nodeRef); + QName type = nodeService.getType(nodeRef); while (type != null && !ContentModel.TYPE_CMOBJECT.equals(type)) { // Add to the list if the type is customisable @@ -290,7 +444,7 @@ public class RecordsManagementAdminServiceImpl extends RecordsManagementAdminBas } // Type and get the types parent - TypeDefinition def = getDictionaryService().getType(type); + TypeDefinition def = dictionaryService.getType(type); if (def != null) { type = def.getParentName(); @@ -302,7 +456,7 @@ public class RecordsManagementAdminServiceImpl extends RecordsManagementAdminBas } // Get all the nodes aspects - Set aspects = getNodeService().getAspects(nodeRef); + Set aspects = nodeService.getAspects(nodeRef); for (QName aspect : aspects) { QName tempAspect = QName.createQName(aspect.toString()); @@ -315,7 +469,7 @@ public class RecordsManagementAdminServiceImpl extends RecordsManagementAdminBas } // Try and get the parent aspect - AspectDefinition aspectDef = getDictionaryService().getAspect(tempAspect); + AspectDefinition aspectDef = dictionaryService.getAspect(tempAspect); if (aspectDef != null) { tempAspect = aspectDef.getParentName(); @@ -337,86 +491,86 @@ public class RecordsManagementAdminServiceImpl extends RecordsManagementAdminBas */ private Map getCustomisableMap() { - if (customisableTypes == null) - { - customisableTypes = new HashMap(7); - Collection aspects = getDictionaryService().getAspects(RM_CUSTOM_MODEL); - for (QName aspect : aspects) - { - AspectDefinition aspectDef = getDictionaryService().getAspect(aspect); - String name = aspectDef.getName().getLocalName(); - if (name.endsWith("Properties")) - { - QName type = null; - String prefixString = aspectDef.getDescription(getDictionaryService()); - if (prefixString == null) - { - // Backward compatibility from previous RM V1.0 custom models - if (CompatibilityModel.NAME_CUSTOM_RECORD_PROPERTIES.equals(name)) - { - type = RecordsManagementModel.ASPECT_RECORD; - } - else if (CompatibilityModel.NAME_CUSTOM_RECORD_FOLDER_PROPERTIES.equals(name)) - { - type = RecordsManagementModel.TYPE_RECORD_FOLDER; - } - else if (CompatibilityModel.NAME_CUSTOM_RECORD_CATEGORY_PROPERTIES.equals(name)) - { - type = RecordsManagementModel.TYPE_RECORD_CATEGORY; - } - else if (CompatibilityModel.NAME_CUSTOM_RECORD_SERIES_PROPERTIES.equals(name) && + if (customisableTypes == null) + { + customisableTypes = new HashMap(7); + Collection aspects = dictionaryService.getAspects(RM_CUSTOM_MODEL); + for (QName aspect : aspects) + { + AspectDefinition aspectDef = dictionaryService.getAspect(aspect); + String name = aspectDef.getName().getLocalName(); + if (name.endsWith("Properties")) + { + QName type = null; + String prefixString = aspectDef.getDescription(dictionaryService); + if (prefixString == null) + { + // Backward compatibility from previous RM V1.0 custom models + if (CompatibilityModel.NAME_CUSTOM_RECORD_PROPERTIES.equals(name)) + { + type = RecordsManagementModel.ASPECT_RECORD; + } + else if (CompatibilityModel.NAME_CUSTOM_RECORD_FOLDER_PROPERTIES.equals(name)) + { + type = RecordsManagementModel.TYPE_RECORD_FOLDER; + } + else if (CompatibilityModel.NAME_CUSTOM_RECORD_CATEGORY_PROPERTIES.equals(name)) + { + type = RecordsManagementModel.TYPE_RECORD_CATEGORY; + } + else if (CompatibilityModel.NAME_CUSTOM_RECORD_SERIES_PROPERTIES.equals(name) && // Only add the deprecated record series type as customisable if // a v1.0 installation has added custom properties - aspectDef.getProperties().size() != 0) - { - type = CompatibilityModel.TYPE_RECORD_SERIES; - } - } - else - { - type = QName.createQName(prefixString, getNamespaceService()); - } + aspectDef.getProperties().size() != 0) + { + type = CompatibilityModel.TYPE_RECORD_SERIES; + } + } + else + { + type = QName.createQName(prefixString, namespaceService); + } - // Add the customisable type to the map - if (type != null) - { - customisableTypes.put(type, aspect); + // Add the customisable type to the map + if (type != null) + { + customisableTypes.put(type, aspect); - // Remove customisable type from the pending list - if (pendingCustomisableTypes != null && pendingCustomisableTypes.contains(type)) - { - pendingCustomisableTypes.remove(type); - } - } - } - } + // Remove customisable type from the pending list + if (pendingCustomisableTypes != null && pendingCustomisableTypes.contains(type)) + { + pendingCustomisableTypes.remove(type); + } + } + } + } - // Deal with any pending types left over - if (pendingCustomisableTypes != null && pendingCustomisableTypes.size() != 0) - { - NodeRef modelRef = getCustomModelRef(RecordsManagementModel.RM_CUSTOM_URI); + // Deal with any pending types left over + if (pendingCustomisableTypes != null && pendingCustomisableTypes.size() != 0) + { + NodeRef modelRef = getCustomModelRef(RecordsManagementModel.RM_CUSTOM_URI); M2Model model = readCustomContentModel(modelRef); - try - { - for (QName customisableType : pendingCustomisableTypes) - { - QName customAspect = getCustomAspectImpl(customisableType); + try + { + for (QName customisableType : pendingCustomisableTypes) + { + QName customAspect = getCustomAspectImpl(customisableType); - // Create the new aspect to hold the custom properties - M2Aspect aspect = model.createAspect(customAspect.toPrefixString(getNamespaceService())); - aspect.setDescription(customisableType.toPrefixString(getNamespaceService())); + // Create the new aspect to hold the custom properties + M2Aspect aspect = model.createAspect(customAspect.toPrefixString(namespaceService)); + aspect.setDescription(customisableType.toPrefixString(namespaceService)); - // Make a record of the customisable type + // Make a record of the customisable type customisableTypes.put(customisableType, customAspect); - } - } - finally - { - writeCustomContentModel(modelRef, model); - } - } - } - return customisableTypes; + } + } + finally + { + writeCustomContentModel(modelRef, model); + } + } + } + return customisableTypes; } /** @@ -427,13 +581,13 @@ public class RecordsManagementAdminServiceImpl extends RecordsManagementAdminBas */ private QName getCustomAspect(QName customisableType) { - Map map = getCustomisableMap(); - QName result = map.get(customisableType); - if (result == null) - { - result = getCustomAspectImpl(customisableType); - } - return result; + Map map = getCustomisableMap(); + QName result = map.get(customisableType); + if (result == null) + { + result = getCustomAspectImpl(customisableType); + } + return result; } /** @@ -444,7 +598,7 @@ public class RecordsManagementAdminServiceImpl extends RecordsManagementAdminBas */ private QName getCustomAspectImpl(QName customisableType) { - String localName = customisableType.toPrefixString(getNamespaceService()).replace(":", ""); + String localName = customisableType.toPrefixString(namespaceService).replace(":", ""); localName = MessageFormat.format("{0}CustomProperties", localName); return QName.createQName(RM_CUSTOM_URI, localName); } @@ -455,9 +609,8 @@ public class RecordsManagementAdminServiceImpl extends RecordsManagementAdminBas @Override public boolean isCustomisable(QName type) { - mandatory("type", type); - - return getCustomisable().contains(type); + ParameterCheck.mandatory("type", type); + return getCustomisable().contains(type); } /** @@ -466,33 +619,33 @@ public class RecordsManagementAdminServiceImpl extends RecordsManagementAdminBas @Override public void makeCustomisable(QName type) { - mandatory("type", type); + ParameterCheck.mandatory("type", type); - if (customisableTypes == null) - { - // Add the type to the pending list - pendingCustomisableTypes.add(type); - } - else - { - QName customAspect = getCustomAspect(type); - if (getDictionaryService().getAspect(customAspect) == null) - { - NodeRef modelRef = getCustomModelRef(customAspect.getNamespaceURI()); - M2Model model = readCustomContentModel(modelRef); - try - { - // Create the new aspect to hold the custom properties - M2Aspect aspect = model.createAspect(customAspect.toPrefixString(getNamespaceService())); - aspect.setDescription(type.toPrefixString(getNamespaceService())); - } - finally - { - writeCustomContentModel(modelRef, model); - } - customisableTypes.put(type, customAspect); - } - } + if (customisableTypes == null) + { + // Add the type to the pending list + pendingCustomisableTypes.add(type); + } + else + { + QName customAspect = getCustomAspect(type); + if (dictionaryService.getAspect(customAspect) == null) + { + NodeRef modelRef = getCustomModelRef(customAspect.getNamespaceURI()); + M2Model model = readCustomContentModel(modelRef); + try + { + // Create the new aspect to hold the custom properties + M2Aspect aspect = model.createAspect(customAspect.toPrefixString(namespaceService)); + aspect.setDescription(type.toPrefixString(namespaceService)); + } + finally + { + writeCustomContentModel(modelRef, model); + } + customisableTypes.put(type, customAspect); + } + } } /** @@ -501,31 +654,31 @@ public class RecordsManagementAdminServiceImpl extends RecordsManagementAdminBas @Override public void unmakeCustomisable(QName type) { - mandatory("type", type); + ParameterCheck.mandatory("type", type); - if (customisableTypes == null) - { - throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_SERVICE_NOT_INIT)); - } + if (customisableTypes == null) + { + throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_SERVICE_NOT_INIT)); + } - QName customAspect = getCustomAspect(type); - if (getDictionaryService().getAspect(customAspect) != null) - { - // TODO need to confirm that the custom properties are not being used! + QName customAspect = getCustomAspect(type); + if (dictionaryService.getAspect(customAspect) != null) + { + // TODO need to confirm that the custom properties are not being used! - NodeRef modelRef = getCustomModelRef(customAspect.getNamespaceURI()); - M2Model model = readCustomContentModel(modelRef); - try - { - // Create the new aspect to hold the custom properties - model.removeAspect(customAspect.toPrefixString(getNamespaceService())); - } - finally - { - writeCustomContentModel(modelRef, model); - } - customisableTypes.remove(type); - } + NodeRef modelRef = getCustomModelRef(customAspect.getNamespaceURI()); + M2Model model = readCustomContentModel(modelRef); + try + { + // Create the new aspect to hold the custom properties + model.removeAspect(customAspect.toPrefixString(namespaceService)); + } + finally + { + writeCustomContentModel(modelRef, model); + } + customisableTypes.remove(type); + } } /** @@ -534,15 +687,15 @@ public class RecordsManagementAdminServiceImpl extends RecordsManagementAdminBas @Override public boolean existsCustomProperty(QName propertyName) { - mandatory("propertyName", propertyName); + ParameterCheck.mandatory("propertyName", propertyName); - boolean result = false; - if (RM_CUSTOM_URI.equals(propertyName.getNamespaceURI()) && - getDictionaryService().getProperty(propertyName) != null) - { - result = true; - } - return result; + boolean result = false; + if (RM_CUSTOM_URI.equals(propertyName.getNamespaceURI()) && + dictionaryService.getProperty(propertyName) != null) + { + result = true; + } + return result; } /** @@ -550,15 +703,15 @@ public class RecordsManagementAdminServiceImpl extends RecordsManagementAdminBas */ public Map getCustomPropertyDefinitions() { - Map result = new HashMap(); - for (QName customisableType : getCustomisable()) - { - Map props = getCustomPropertyDefinitions(customisableType); - if (props != null) - { - result.putAll(props); - } - } + Map result = new HashMap(); + for (QName customisableType : getCustomisable()) + { + Map props = getCustomPropertyDefinitions(customisableType); + if (props != null) + { + result.putAll(props); + } + } return result; } @@ -567,14 +720,12 @@ public class RecordsManagementAdminServiceImpl extends RecordsManagementAdminBas */ public Map getCustomPropertyDefinitions(QName customisableType) { - mandatory("customisableType", customisableType); - - Map propDefns = null; - QName relevantAspectQName = getCustomAspect(customisableType); - AspectDefinition aspectDefn = getDictionaryService().getAspect(relevantAspectQName); + Map propDefns = null; + QName relevantAspectQName = getCustomAspect(customisableType); + AspectDefinition aspectDefn = dictionaryService.getAspect(relevantAspectQName); if (aspectDefn != null) { - propDefns = aspectDefn.getProperties(); + propDefns = aspectDefn.getProperties(); } return propDefns; @@ -606,7 +757,7 @@ public class RecordsManagementAdminServiceImpl extends RecordsManagementAdminBas { if (!isCustomisable(aspectName)) { - throw new NotCustomisableMetadataException(aspectName.toPrefixString(getNamespaceService())); + throw new NotCustomisableMetadataException(aspectName.toPrefixString(namespaceService)); } // title parameter is currently ignored. Intentionally. @@ -616,22 +767,22 @@ public class RecordsManagementAdminServiceImpl extends RecordsManagementAdminBas propId = this.generateQNameFor(label); } - mandatory("aspectName", aspectName); - mandatory("label", label); - mandatory("dataType", dataType); + ParameterCheck.mandatory("aspectName", aspectName); + ParameterCheck.mandatory("label", label); + ParameterCheck.mandatory("dataType", dataType); NodeRef modelRef = getCustomModelRef(propId.getNamespaceURI()); M2Model deserializedModel = readCustomContentModel(modelRef); QName customAspect = getCustomAspect(aspectName); - M2Aspect customPropsAspect = deserializedModel.getAspect(customAspect.toPrefixString(getNamespaceService())); + M2Aspect customPropsAspect = deserializedModel.getAspect(customAspect.toPrefixString(namespaceService)); if (customPropsAspect == null) { - throw new InvalidCustomAspectMetadataException(customAspect, aspectName.toPrefixString(getNamespaceService())); + throw new InvalidCustomAspectMetadataException(customAspect, aspectName.toPrefixString(namespaceService)); } - String propIdAsString = propId.toPrefixString(getNamespaceService()); + String propIdAsString = propId.toPrefixString(namespaceService); M2Property customProp = customPropsAspect.getProperty(propIdAsString); if (customProp != null) { @@ -640,7 +791,7 @@ public class RecordsManagementAdminServiceImpl extends RecordsManagementAdminBas M2Property newProp = customPropsAspect.createProperty(propIdAsString); newProp.setName(propIdAsString); - newProp.setType(dataType.toPrefixString(getNamespaceService())); + newProp.setType(dataType.toPrefixString(namespaceService)); // Note that the title is used to store the RM 'label'. newProp.setTitle(label); @@ -663,7 +814,7 @@ public class RecordsManagementAdminServiceImpl extends RecordsManagementAdminBas throw new CannotApplyConstraintMetadataException(lovConstraint, propIdAsString, dataType); } - String lovConstraintQNameAsString = lovConstraint.toPrefixString(getNamespaceService()); + String lovConstraintQNameAsString = lovConstraint.toPrefixString(namespaceService); newProp.addConstraintRef(lovConstraintQNameAsString); } @@ -683,9 +834,9 @@ public class RecordsManagementAdminServiceImpl extends RecordsManagementAdminBas */ public QName updateCustomPropertyDefinitionName(QName propQName, String newName) throws CustomMetadataException { - mandatory("propQName", propQName); + ParameterCheck.mandatory("propQName", propQName); - PropertyDefinition propDefn = getDictionaryService().getProperty(propQName); + PropertyDefinition propDefn = dictionaryService.getProperty(propQName); if (propDefn == null) { throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_PROP_EXIST, propQName)); @@ -699,11 +850,11 @@ public class RecordsManagementAdminServiceImpl extends RecordsManagementAdminBas QName newPropQName = getQNameForClientId(newName); if (newPropQName != null) { - PropertyDefinition newPropDefn = getDictionaryService().getProperty(newPropQName); + PropertyDefinition newPropDefn = dictionaryService.getProperty(newPropQName); if (newPropDefn != null && !propDefn.equals(newPropDefn)) { // The requested QName is already in use - String propIdAsString = newPropQName.toPrefixString(getNamespaceService()); + String propIdAsString = newPropQName.toPrefixString(namespaceService); throw new PropertyAlreadyExistsMetadataException(propIdAsString); } } @@ -730,9 +881,9 @@ public class RecordsManagementAdminServiceImpl extends RecordsManagementAdminBas */ public QName setCustomPropertyDefinitionLabel(QName propQName, String newLabel) { - mandatory("propQName", propQName); + ParameterCheck.mandatory("propQName", propQName); - PropertyDefinition propDefn = getDictionaryService().getProperty(propQName); + PropertyDefinition propDefn = dictionaryService.getProperty(propQName); if (propDefn == null) { throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_PROP_EXIST, propQName)); @@ -765,10 +916,9 @@ public class RecordsManagementAdminServiceImpl extends RecordsManagementAdminBas */ public QName setCustomPropertyDefinitionConstraint(QName propQName, QName newLovConstraint) { - mandatory("propQName", propQName); - mandatory("newLovConstraint", newLovConstraint); + ParameterCheck.mandatory("propQName", propQName); - PropertyDefinition propDefn = getDictionaryService().getProperty(propQName); + PropertyDefinition propDefn = dictionaryService.getProperty(propQName); if (propDefn == null) { throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_PROP_EXIST, propQName)); @@ -780,12 +930,12 @@ public class RecordsManagementAdminServiceImpl extends RecordsManagementAdminBas M2Property targetProp = findProperty(propQName, deserializedModel); String dataType = targetProp.getType(); - if (! dataType.equals(DataTypeDefinition.TEXT.toPrefixString(getNamespaceService()))) + if (! dataType.equals(DataTypeDefinition.TEXT.toPrefixString(namespaceService))) { throw new AlfrescoRuntimeException(I18NUtil.getMessage(CannotApplyConstraintMetadataException.MSG_CANNOT_APPLY_CONSTRAINT, newLovConstraint, targetProp.getName(), dataType)); } - String lovConstraintQNameAsString = newLovConstraint.toPrefixString(getNamespaceService()); + String lovConstraintQNameAsString = newLovConstraint.toPrefixString(namespaceService); // Add the constraint - if it isn't already there. String refOfExistingConstraint = null; @@ -817,9 +967,9 @@ public class RecordsManagementAdminServiceImpl extends RecordsManagementAdminBas */ public QName removeCustomPropertyDefinitionConstraints(QName propQName) { - mandatory("propQName", propQName); + ParameterCheck.mandatory("propQName", propQName); - PropertyDefinition propDefn = getDictionaryService().getProperty(propQName); + PropertyDefinition propDefn = dictionaryService.getProperty(propQName); if (propDefn == null) { throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_PROP_EXIST, propQName)); @@ -831,8 +981,7 @@ public class RecordsManagementAdminServiceImpl extends RecordsManagementAdminBas M2Property targetProperty = findProperty(propQName, deserializedModel); // Need to count backwards to remove constraints - for (int i = targetProperty.getConstraints().size() - 1; i >= 0; i--) - { + for (int i = targetProperty.getConstraints().size() - 1; i >= 0; i--) { String ref = targetProperty.getConstraints().get(i).getRef(); targetProperty.removeConstraintRef(ref); } @@ -861,7 +1010,7 @@ public class RecordsManagementAdminServiceImpl extends RecordsManagementAdminBas { for (M2Property prop : aspect.getProperties()) { - if (propQName.toPrefixString(getNamespaceService()).equals(prop.getName())) + if (propQName.toPrefixString(namespaceService).equals(prop.getName())) { return prop; } @@ -875,12 +1024,12 @@ public class RecordsManagementAdminServiceImpl extends RecordsManagementAdminBas */ public void removeCustomPropertyDefinition(QName propQName) { - mandatory("propQName", propQName); + ParameterCheck.mandatory("propQName", propQName); NodeRef modelRef = getCustomModelRef(propQName.getNamespaceURI()); M2Model deserializedModel = readCustomContentModel(modelRef); - String propQNameAsString = propQName.toPrefixString(getNamespaceService()); + String propQNameAsString = propQName.toPrefixString(namespaceService); String aspectName = null; @@ -890,7 +1039,7 @@ public class RecordsManagementAdminServiceImpl extends RecordsManagementAdminBas // attempt to delete the property definition. for (QName customisableType : getCustomisable()) { - aspectName = getCustomAspect(customisableType).toPrefixString(getNamespaceService()); + aspectName = getCustomAspect(customisableType).toPrefixString(namespaceService); M2Aspect customPropsAspect = deserializedModel.getAspect(aspectName); if (customPropsAspect == null) @@ -933,41 +1082,123 @@ public class RecordsManagementAdminServiceImpl extends RecordsManagementAdminBas */ public Map getCustomReferenceDefinitions() { - return getCustomAssociations(); + AspectDefinition aspectDefn = dictionaryService.getAspect(ASPECT_CUSTOM_ASSOCIATIONS); + Map assocDefns = aspectDefn.getAssociations(); + + return assocDefns; } /** * @see org.alfresco.module.org_alfresco_module_rm.RecordsManagementAdminService#addCustomReference(org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.namespace.QName) */ - public void addCustomReference(NodeRef fromNode, NodeRef toNode, QName refId) - { - mandatory("fromNode", fromNode); - mandatory("toNode", toNode); - mandatory("refId", refId); + public void addCustomReference(NodeRef fromNode, NodeRef toNode, QName refId) + { + // Check that a definition for the reference type exists. + Map availableAssocs = this.getCustomReferenceDefinitions(); - getRelationshipService().addRelationship(refId.getLocalName(), fromNode, toNode); - } + AssociationDefinition assocDef = availableAssocs.get(refId); + if (assocDef == null) + { + throw new IllegalArgumentException(I18NUtil.getMessage(MSG_REF_EXIST, refId)); + } - /** - * @see org.alfresco.module.org_alfresco_module_rm.admin.RecordsManagementAdminService#removeCustomReference(org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.namespace.QName) - */ - public void removeCustomReference(final NodeRef fromNode, final NodeRef toNode, final QName assocId) - { - mandatory("fromNode", fromNode); - mandatory("toNode", toNode); - mandatory("assocId",assocId); + // Check if an instance of this reference type already exists in the same direction. + boolean associationAlreadyExists = false; + if (assocDef.isChild()) + { + List childAssocs = nodeService.getChildAssocs(fromNode, assocDef.getName(), assocDef.getName()); + for (ChildAssociationRef chAssRef : childAssocs) + { + if (chAssRef.getChildRef().equals(toNode)) + { + associationAlreadyExists = true; + } + } + } + else + { + List assocs = nodeService.getTargetAssocs(fromNode, assocDef.getName()); + for (AssociationRef assRef : assocs) + { + if (assRef.getTargetRef().equals(toNode)) + { + associationAlreadyExists = true; + } + } + } + if (associationAlreadyExists) + { + StringBuilder msg = new StringBuilder(); + msg.append("Association '").append(refId).append("' already exists from ") + .append(fromNode).append(" to ").append(toNode); + throw new AlfrescoRuntimeException(msg.toString()); + } - getRelationshipService().removeRelationship(assocId.getLocalName(), fromNode, toNode); - } + // Invoke before create reference policy + invokeBeforeCreateReference(fromNode, toNode, refId); + + if (assocDef.isChild()) + { + this.nodeService.addChild(fromNode, toNode, refId, refId); + } + else + { + this.nodeService.createAssociation(fromNode, toNode, refId); + } + + // Invoke on create reference policy + invokeOnCreateReference(fromNode, toNode, refId); + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.admin.RecordsManagementAdminService#removeCustomReference(org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.namespace.QName) + */ + public void removeCustomReference(final NodeRef fromNode, final NodeRef toNode, final QName assocId) + { + Map availableAssocs = this.getCustomReferenceDefinitions(); + + AssociationDefinition assocDef = availableAssocs.get(assocId); + if (assocDef == null) + { + throw new IllegalArgumentException(I18NUtil.getMessage(MSG_REF_EXIST, assocId)); + } + + invokeBeforeRemoveReference(fromNode, toNode, assocId); + + if (assocDef.isChild()) + { + AuthenticationUtil.runAsSystem(new RunAsWork() + { + @Override + public Void doWork() + { + List children = nodeService.getChildAssocs(fromNode); + for (ChildAssociationRef chRef : children) + { + if (assocId.equals(chRef.getTypeQName()) && chRef.getChildRef().equals(toNode)) + { + nodeService.removeChildAssociation(chRef); + } + } + + return null; + } + }); + } + else + { + nodeService.removeAssociation(fromNode, toNode, assocId); + } + + invokeOnRemoveReference(fromNode, toNode, assocId); + } /** * @see org.alfresco.module.org_alfresco_module_rm.admin.RecordsManagementAdminService#getCustomReferencesFrom(org.alfresco.service.cmr.repository.NodeRef) */ public List getCustomReferencesFrom(NodeRef node) { - mandatory("node", node); - - return getNodeService().getTargetAssocs(node, RegexQNamePattern.MATCH_ALL); + return nodeService.getTargetAssocs(node, RegexQNamePattern.MATCH_ALL); } /** @@ -975,9 +1206,7 @@ public class RecordsManagementAdminServiceImpl extends RecordsManagementAdminBas */ public List getCustomChildReferences(NodeRef node) { - mandatory("node", node); - - return getNodeService().getChildAssocs(node); + return nodeService.getChildAssocs(node); } /** @@ -985,9 +1214,7 @@ public class RecordsManagementAdminServiceImpl extends RecordsManagementAdminBas */ public List getCustomReferencesTo(NodeRef node) { - mandatory("node", node); - - return getNodeService().getSourceAssocs(node, RegexQNamePattern.MATCH_ALL); + return nodeService.getSourceAssocs(node, RegexQNamePattern.MATCH_ALL); } /** @@ -995,83 +1222,206 @@ public class RecordsManagementAdminServiceImpl extends RecordsManagementAdminBas */ public List getCustomParentReferences(NodeRef node) { - mandatory("node", node); - - return getNodeService().getParentAssocs(node); + return nodeService.getParentAssocs(node); } - /** - * @see org.alfresco.module.org_alfresco_module_rm.admin.RecordsManagementAdminService#addCustomAssocDefinition(java.lang.String) - * - * note: currently RMC custom assocs only - */ + // note: currently RMC custom assocs only public QName addCustomAssocDefinition(String label) { - mandatoryString("label", label); + ParameterCheck.mandatoryString("label", label); - return addCustomChildAssocDefinition(label, label); + // If this label is already taken... + if (existsLabel(label)) + { + throw new IllegalArgumentException(I18NUtil.getMessage(MSG_REF_LABEL_IN_USE, label)); + } + + // defaults to RM_CUSTOM_URI + NodeRef modelRef = getCustomModelRef(""); + M2Model deserializedModel = readCustomContentModel(modelRef); + + String aspectName = RecordsManagementAdminServiceImpl.RMC_CUSTOM_ASSOCS; + + M2Aspect customAssocsAspect = deserializedModel.getAspect(aspectName); + + if (customAssocsAspect == null) + { + throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_UNKNOWN_ASPECT, aspectName)); + } + + QName generatedQName = this.generateQNameFor(label); + String generatedShortQName = generatedQName.toPrefixString(namespaceService); + + M2ClassAssociation customAssoc = customAssocsAspect.getAssociation(generatedShortQName); + if (customAssoc != null) + { + throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_ASSOC_EXISTS, generatedShortQName)); + } + + M2Association newAssoc = customAssocsAspect.createAssociation(generatedShortQName); + newAssoc.setSourceMandatory(false); + newAssoc.setTargetMandatory(false); + + // MOB-1573 + newAssoc.setSourceMany(true); + newAssoc.setTargetMany(true); + + // The label is stored in the title. + newAssoc.setTitle(label); + + // TODO Could be the customAssocs aspect + newAssoc.setTargetClassName(RecordsManagementAdminServiceImpl.RMA_RECORD); + + writeCustomContentModel(modelRef, deserializedModel); + + if (logger.isInfoEnabled()) + { + logger.info("addCustomAssocDefinition: ("+label+")"); + } + + return generatedQName; } - /** - * @see org.alfresco.module.org_alfresco_module_rm.admin.RecordsManagementAdminService#addCustomChildAssocDefinition(java.lang.String, java.lang.String) - * - * note: currently RMC custom assocs only - */ + private boolean existsLabel(String label) + { + for (AssociationDefinition associationDefinition : getCustomReferenceDefinitions().values()) + { + if (associationDefinition.getTitle(dictionaryService).equalsIgnoreCase(label)) + { + return true; + } + } + return false; + } + + // note: currently RMC custom assocs only public QName addCustomChildAssocDefinition(String source, String target) { - mandatoryString("source", source); - mandatoryString("target", target); + ParameterCheck.mandatoryString("source", source); + ParameterCheck.mandatoryString("target", target); - RelationshipDisplayName displayName = new RelationshipDisplayName(source, target); - RelationshipDefinition relationshipDefinition = getRelationshipService().createRelationshipDefinition(displayName); + String compoundID = this.getCompoundIdFor(source, target); + if (existsLabel(compoundID)) + { + return null; + } - return QName.createQName(RM_CUSTOM_PREFIX, relationshipDefinition.getUniqueName(), getNamespaceService()); + // defaults to RM_CUSTOM_URI + NodeRef modelRef = getCustomModelRef(""); + M2Model deserializedModel = readCustomContentModel(modelRef); + + String aspectName = RecordsManagementAdminServiceImpl.RMC_CUSTOM_ASSOCS; + + M2Aspect customAssocsAspect = deserializedModel.getAspect(aspectName); + + if (customAssocsAspect == null) + { + throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_UNKNOWN_ASPECT, aspectName)); + } + + M2ClassAssociation customAssoc = customAssocsAspect.getAssociation(compoundID); + if (customAssoc != null) + { + throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_CHILD_ASSOC_EXISTS, compoundID)); + } + QName generatedQName = this.generateQNameFor(compoundID); + + M2ChildAssociation newAssoc = customAssocsAspect.createChildAssociation(generatedQName.toPrefixString(namespaceService)); + newAssoc.setSourceMandatory(false); + newAssoc.setTargetMandatory(false); + + // MOB-1573 + newAssoc.setSourceMany(true); + newAssoc.setTargetMany(true); + + // source and target are stored in title. + newAssoc.setTitle(compoundID); + + // TODO Could be the custom assocs aspect + newAssoc.setTargetClassName(RecordsManagementAdminServiceImpl.RMA_RECORD); + + writeCustomContentModel(modelRef, deserializedModel); + + if (logger.isInfoEnabled()) + { + logger.info("addCustomChildAssocDefinition: ("+source+","+target+")"); + } + + return generatedQName; } - /** - * @see org.alfresco.module.org_alfresco_module_rm.admin.RecordsManagementAdminService#updateCustomChildAssocDefinition(org.alfresco.service.namespace.QName, java.lang.String, java.lang.String) - * - * note: currently RMC custom assocs only - */ + // note: currently RMC custom assocs only public QName updateCustomChildAssocDefinition(QName refQName, String newSource, String newTarget) { - mandatory("refQName", refQName); - mandatoryString("newSource", newSource); - mandatoryString("newTarget", newTarget); - - RelationshipDisplayName displayName = new RelationshipDisplayName(newSource, newTarget); - String localName = refQName.getLocalName(); - RelationshipDefinition relationshipDefinition = getRelationshipService().updateRelationshipDefinition(localName, displayName); - return QName.createQName(RM_CUSTOM_PREFIX, relationshipDefinition.getUniqueName(), getNamespaceService()); + String compoundId = getCompoundIdFor(newSource, newTarget); + // If this compoundId is already taken... + if (existsLabel(compoundId)) + { + throw new IllegalArgumentException(I18NUtil.getMessage(MSG_REF_LABEL_IN_USE, compoundId)); + } + return persistUpdatedAssocTitle(refQName, compoundId); } - /** - * @see org.alfresco.module.org_alfresco_module_rm.admin.RecordsManagementAdminService#updateCustomAssocDefinition(org.alfresco.service.namespace.QName, java.lang.String) - * - * note: currently RMC custom assocs only - */ + // note: currently RMC custom assocs only public QName updateCustomAssocDefinition(QName refQName, String newLabel) { - mandatory("refQName", refQName); - mandatoryString("newLabel", newLabel); - - return updateCustomChildAssocDefinition(refQName, newLabel, newLabel); + // If this label is already taken... + if (existsLabel(newLabel)) + { + throw new IllegalArgumentException(I18NUtil.getMessage(MSG_REF_LABEL_IN_USE, newLabel)); + } + return persistUpdatedAssocTitle(refQName, newLabel); } /** - * @see org.alfresco.module.org_alfresco_module_rm.admin.RecordsManagementAdminService#addCustomConstraintDefinition(org.alfresco.service.namespace.QName, java.lang.String, boolean, java.util.List, org.alfresco.module.org_alfresco_module_rm.caveat.RMListOfValuesConstraint.MatchLogic) + * This method writes the specified String into the association's title property. + * For RM custom properties and references, Title is used to store the identifier. */ + // note: currently RMC custom assocs only + private QName persistUpdatedAssocTitle(QName refQName, String newTitle) + { + ParameterCheck.mandatory("refQName", refQName); + + AssociationDefinition assocDefn = dictionaryService.getAssociation(refQName); + if (assocDefn == null) + { + throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_CONNOT_FIND_ASSOC_DEF, refQName)); + } + + // defaults to RM_CUSTOM_URI + NodeRef modelRef = getCustomModelRef(""); + M2Model deserializedModel = readCustomContentModel(modelRef); + + M2Aspect customAssocsAspect = deserializedModel.getAspect(RMC_CUSTOM_ASSOCS); + + for (M2ClassAssociation assoc : customAssocsAspect.getAssociations()) + { + if (refQName.toPrefixString(namespaceService).equals(assoc.getName()) && newTitle != null) + { + assoc.setTitle(newTitle); + } + } + writeCustomContentModel(modelRef, deserializedModel); + + if (logger.isInfoEnabled()) + { + logger.info("persistUpdatedAssocTitle: "+refQName+ + "=" + newTitle + " to aspect: " + RMC_CUSTOM_ASSOCS); + } + + return refQName; + } + public void addCustomConstraintDefinition(QName constraintName, String title, boolean caseSensitive, List allowedValues, MatchLogic matchLogic) { - mandatory("constraintName", constraintName); - mandatoryString("title", title); - mandatory("allowedValues", allowedValues); - mandatory("matchLogic", matchLogic); + ParameterCheck.mandatory("constraintName", constraintName); + ParameterCheck.mandatoryString("title", title); + ParameterCheck.mandatory("allowedValues", allowedValues); NodeRef modelRef = getCustomModelRef(constraintName.getNamespaceURI()); M2Model deserializedModel = readCustomContentModel(modelRef); - String constraintNameAsPrefixString = constraintName.toPrefixString(getNamespaceService()); + String constraintNameAsPrefixString = constraintName.toPrefixString(namespaceService); M2Constraint customConstraint = deserializedModel.getConstraint(constraintNameAsPrefixString); if (customConstraint != null) @@ -1094,18 +1444,15 @@ public class RecordsManagementAdminServiceImpl extends RecordsManagementAdminBas } } - /** - * @see org.alfresco.module.org_alfresco_module_rm.admin.RecordsManagementAdminService#changeCustomConstraintValues(org.alfresco.service.namespace.QName, java.util.List) - */ public void changeCustomConstraintValues(QName constraintName, List newAllowedValues) { - mandatory("constraintName", constraintName); - mandatory("newAllowedValues", newAllowedValues); + ParameterCheck.mandatory("constraintName", constraintName); + ParameterCheck.mandatory("newAllowedValues", newAllowedValues); NodeRef modelRef = getCustomModelRef(constraintName.getNamespaceURI()); M2Model deserializedModel = readCustomContentModel(modelRef); - String constraintNameAsPrefixString = constraintName.toPrefixString(getNamespaceService()); + String constraintNameAsPrefixString = constraintName.toPrefixString(namespaceService); M2Constraint customConstraint = deserializedModel.getConstraint(constraintNameAsPrefixString); if (customConstraint == null) @@ -1132,18 +1479,15 @@ public class RecordsManagementAdminServiceImpl extends RecordsManagementAdminBas } } - /** - * @see org.alfresco.module.org_alfresco_module_rm.admin.RecordsManagementAdminService#changeCustomConstraintTitle(org.alfresco.service.namespace.QName, java.lang.String) - */ public void changeCustomConstraintTitle(QName constraintName, String title) { - mandatory("constraintName", constraintName); - mandatoryString("title", title); + ParameterCheck.mandatory("constraintName", constraintName); + ParameterCheck.mandatoryString("title", title); NodeRef modelRef = getCustomModelRef(constraintName.getNamespaceURI()); M2Model deserializedModel = readCustomContentModel(modelRef); - String constraintNameAsPrefixString = constraintName.toPrefixString(getNamespaceService()); + String constraintNameAsPrefixString = constraintName.toPrefixString(namespaceService); M2Constraint customConstraint = deserializedModel.getConstraint(constraintNameAsPrefixString); if (customConstraint == null) @@ -1168,14 +1512,9 @@ public class RecordsManagementAdminServiceImpl extends RecordsManagementAdminBas } } - /** - * @see org.alfresco.module.org_alfresco_module_rm.admin.RecordsManagementAdminService#getCustomConstraintDefinitions(org.alfresco.service.namespace.QName) - */ public List getCustomConstraintDefinitions(QName modelQName) { - mandatory("modelQName", modelQName); - - Collection conDefs = getDictionaryService().getConstraints(modelQName, true); + Collection conDefs = dictionaryService.getConstraints(modelQName, true); for (ConstraintDefinition conDef : conDefs) { @@ -1189,17 +1528,14 @@ public class RecordsManagementAdminServiceImpl extends RecordsManagementAdminBas return new ArrayList(conDefs); } - /** - * @see org.alfresco.module.org_alfresco_module_rm.admin.RecordsManagementAdminService#removeCustomConstraintDefinition(org.alfresco.service.namespace.QName) - */ public void removeCustomConstraintDefinition(QName constraintName) { - mandatory("constraintName", constraintName); + ParameterCheck.mandatory("constraintName", constraintName); NodeRef modelRef = getCustomModelRef(constraintName.getNamespaceURI()); M2Model deserializedModel = readCustomContentModel(modelRef); - String constraintNameAsPrefixString = constraintName.toPrefixString(getNamespaceService()); + String constraintNameAsPrefixString = constraintName.toPrefixString(namespaceService); M2Constraint customConstraint = deserializedModel.getConstraint(constraintNameAsPrefixString); if (customConstraint == null) @@ -1218,9 +1554,96 @@ public class RecordsManagementAdminServiceImpl extends RecordsManagementAdminBas } } - /** - * @see org.alfresco.module.org_alfresco_module_rm.admin.RecordsManagementAdminService#getQNameForClientId(java.lang.String) - */ + private NodeRef getCustomModelRef(String uri) + { + if ((uri.equals("")) || (uri.equals(RecordsManagementModel.RM_CUSTOM_URI))) + { + // note: short-cut for "rmc" currently assumes that RM custom model does not define additional namespaces + return RM_CUSTOM_MODEL_NODE_REF; + } + else + { + // ALF-5875 + List modelRefs = dictonaryRepositoryBootstrap.getModelRefs(); + + for (NodeRef modelRef : modelRefs) + { + try + { + M2Model model = readCustomContentModel(modelRef); + + for (M2Namespace namespace : model.getNamespaces()) + { + if (namespace.getUri().equals(uri)) + { + return modelRef; + } + } + } + catch (DictionaryException de) + { + logger.warn("readCustomContentModel: skip model ("+modelRef+") whilst searching for uri ("+uri+"): "+de); + } + } + + throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_CUSTOM_MODEL_NOT_FOUND, uri)); + } + } + + private M2Model readCustomContentModel(NodeRef modelNodeRef) + { + ContentReader reader = this.contentService.getReader(modelNodeRef, + ContentModel.TYPE_CONTENT); + + if (!reader.exists()) {throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_CUSTOM_MODEL_NO_CONTENT, modelNodeRef.toString()));} + + InputStream contentIn = null; + M2Model deserializedModel = null; + try + { + contentIn = reader.getContentInputStream(); + deserializedModel = M2Model.createModel(contentIn); + } + finally + { + try + { + if (contentIn != null) + { + contentIn.close(); + } + } + catch (IOException ignored) + { + // Intentionally empty.` + } + } + return deserializedModel; + } + + private void writeCustomContentModel(NodeRef modelRef, M2Model deserializedModel) + { + ContentWriter writer = this.contentService.getWriter(modelRef, ContentModel.TYPE_CONTENT, true); + writer.setMimetype(MimetypeMap.MIMETYPE_XML); + writer.setEncoding("UTF-8"); + + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + deserializedModel.toXML(baos); + + String updatedModelXml; + try + { + updatedModelXml = baos.toString("UTF-8"); + writer.putContent(updatedModelXml); + // putContent closes all resources. + // so we don't have to. + } catch (UnsupportedEncodingException uex) + { + throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_ERROR_WRITE_CUSTOM_MODEL, modelRef.toString()), uex); + } + } + + public QName getQNameForClientId(String localName) { //TODO 1. After certification. This implementation currently does not support reference, @@ -1256,10 +1679,6 @@ public class RecordsManagementAdminServiceImpl extends RecordsManagementAdminBas return referenceResult; } - /** - * @param clientId - * @return - */ private QName generateQNameFor(String clientId) { if (getQNameForClientId(clientId) != null) @@ -1269,29 +1688,34 @@ public class RecordsManagementAdminServiceImpl extends RecordsManagementAdminBas } String newGUID = GUID.generate(); - QName newQName = QName.createQName(RM_CUSTOM_PREFIX, newGUID, getNamespaceService()); + QName newQName = QName.createQName(RM_CUSTOM_PREFIX, newGUID, namespaceService); return newQName; } - /** - * @see org.alfresco.module.org_alfresco_module_rm.admin.RecordsManagementAdminService#splitSourceTargetId(java.lang.String) - */ public String[] splitSourceTargetId(String sourceTargetId) { - mandatoryString("sourceTargetId", sourceTargetId); - - return splitAssociationDefinitionTitle(sourceTargetId); + if (!sourceTargetId.contains(SOURCE_TARGET_ID_SEPARATOR)) + { + throw new IllegalArgumentException(I18NUtil.getMessage(MSG_ERROR_SPLIT_ID, sourceTargetId, SOURCE_TARGET_ID_SEPARATOR)); + } + return sourceTargetId.split(SOURCE_TARGET_ID_SEPARATOR); } - /** - * @see org.alfresco.module.org_alfresco_module_rm.admin.RecordsManagementAdminService#getCompoundIdFor(java.lang.String, java.lang.String) - */ public String getCompoundIdFor(String sourceId, String targetId) { - mandatoryString("sourceId", sourceId); - mandatoryString("targetId", targetId); + ParameterCheck.mandatoryString("sourceId", sourceId); + ParameterCheck.mandatoryString("targetId", targetId); - return composeAssociationDefinitionTitle(sourceId, targetId); + if (sourceId.contains(SOURCE_TARGET_ID_SEPARATOR)) + { + throw new IllegalArgumentException("sourceId cannot contain '" + SOURCE_TARGET_ID_SEPARATOR + + "': " + sourceId); + } + StringBuilder result = new StringBuilder(); + result.append(sourceId) + .append(SOURCE_TARGET_ID_SEPARATOR) + .append(targetId); + return result.toString(); } } diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/audit/RecordsManagementAuditServiceImpl.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/audit/RecordsManagementAuditServiceImpl.java index f7fdc6a452..b0b406217c 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/audit/RecordsManagementAuditServiceImpl.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/audit/RecordsManagementAuditServiceImpl.java @@ -48,6 +48,7 @@ import org.alfresco.repo.policy.PolicyComponent; import org.alfresco.repo.transaction.AlfrescoTransactionSupport; import org.alfresco.repo.transaction.RetryingTransactionHelper; import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback; +import org.alfresco.repo.transaction.TransactionListenerAdapter; import org.alfresco.repo.transaction.TransactionalResourceHelper; import org.alfresco.service.cmr.audit.AuditQueryParameters; import org.alfresco.service.cmr.audit.AuditService; @@ -68,7 +69,6 @@ import org.alfresco.util.Pair; import org.alfresco.util.PropertyCheck; import org.alfresco.util.PropertyMap; import org.alfresco.util.TempFileProvider; -import org.alfresco.util.transaction.TransactionListenerAdapter; import org.apache.commons.lang.StringEscapeUtils; import org.apache.commons.lang.time.DateUtils; import org.apache.commons.logging.Log; @@ -1410,25 +1410,17 @@ public class RecordsManagementAuditServiceImpl extends AbstractLifecycleBean json.put("fullName", entry.getFullName() == null ? "": entry.getFullName()); json.put("nodeRef", entry.getNodeRef() == null ? "": entry.getNodeRef()); - // TODO: Find another way for checking the event - if (entry.getEvent().equals("Create Person") && entry.getNodeRef() != null) + if (entry.getEvent().equals("createPerson") && entry.getNodeRef() != null) { NodeRef nodeRef = entry.getNodeRef(); String userName = (String)nodeService.getProperty(nodeRef, ContentModel.PROP_USERNAME); json.put("nodeName", userName == null ? "": userName); - json.put("createPerson", true); } else { json.put("nodeName", entry.getNodeName() == null ? "": entry.getNodeName()); } - // TODO: Find another way for checking the event - if (entry.getEvent().equals("Delete RM Object")) - { - json.put("deleteObject", true); - } - json.put("nodeType", entry.getNodeType() == null ? "": entry.getNodeType()); json.put("event", entry.getEvent() == null ? "": getAuditEventLabel(entry.getEvent())); json.put("identifier", entry.getIdentifier() == null ? "": entry.getIdentifier()); diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/audit/event/RecordableVersionPolicyAuditEvent.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/audit/event/RecordableVersionPolicyAuditEvent.java deleted file mode 100644 index bcad9a0997..0000000000 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/audit/event/RecordableVersionPolicyAuditEvent.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright (C) 2005-2014 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - */ -package org.alfresco.module.org_alfresco_module_rm.audit.event; - -import static org.alfresco.module.org_alfresco_module_rm.version.RecordableVersionModel.PROP_RECORDABLE_VERSION_POLICY; - -import java.io.Serializable; -import java.util.Map; - -import org.alfresco.repo.node.NodeServicePolicies.OnUpdatePropertiesPolicy; -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.NodeRef; -import org.alfresco.service.namespace.QName; - -/** - * Audits recordable version policy property updates - * - * @author Tuna Aksoy - * @since 2.3 - */ -@BehaviourBean -public class RecordableVersionPolicyAuditEvent extends AuditEvent implements OnUpdatePropertiesPolicy -{ - /** - * @see org.alfresco.repo.node.NodeServicePolicies.OnUpdatePropertiesPolicy#onUpdateProperties(org.alfresco.service.cmr.repository.NodeRef, java.util.Map, java.util.Map) - */ - @Override - @Behaviour - ( - kind = BehaviourKind.CLASS, - type = "cm:cmobject" - ) - public void onUpdateProperties(NodeRef nodeRef, Map before, Map after) - { - if (before.get(PROP_RECORDABLE_VERSION_POLICY) != after.get(PROP_RECORDABLE_VERSION_POLICY)) - { - recordsManagementAuditService.auditEvent(nodeRef, getName(), before, after, true, true); - } - } -} diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/audit/extractor/AuthenticatedUserRolesDataExtractor.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/audit/extractor/AuthenticatedUserRolesDataExtractor.java index c01411aa73..a1ff86aa76 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/audit/extractor/AuthenticatedUserRolesDataExtractor.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/audit/extractor/AuthenticatedUserRolesDataExtractor.java @@ -94,22 +94,18 @@ public final class AuthenticatedUserRolesDataExtractor extends AbstractDataExtra return null; } - StringBuilder sb = new StringBuilder(100); - // Get the rm root NodeRef rmRootNodeRef = filePlanService.getFilePlan(nodeRef); - if (rmRootNodeRef != null) + Set roles = filePlanRoleService.getRolesByUser(rmRootNodeRef, user); + StringBuilder sb = new StringBuilder(100); + for (Role role : roles) { - Set roles = filePlanRoleService.getRolesByUser(rmRootNodeRef, user); - for (Role role : roles) + if (sb.length() > 0) { - if (sb.length() > 0) - { - sb.append(", "); - } - sb.append(role.getDisplayLabel()); + sb.append(", "); } + sb.append(role.getDisplayLabel()); } // Done diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/audit/extractor/FilePlanNamePathDataExtractor.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/audit/extractor/FilePlanNamePathDataExtractor.java index 4e267aa55a..c38636c8ff 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/audit/extractor/FilePlanNamePathDataExtractor.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/audit/extractor/FilePlanNamePathDataExtractor.java @@ -27,7 +27,6 @@ import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; import org.alfresco.repo.audit.extractor.AbstractDataExtractor; import org.alfresco.service.cmr.repository.NodeRef; import org.alfresco.service.cmr.repository.NodeService; -import org.alfresco.service.cmr.rule.RuleService; /** * An extractor that extracts the cm:name path from the RM root down to @@ -43,7 +42,6 @@ public final class FilePlanNamePathDataExtractor extends AbstractDataExtractor { private NodeService nodeService; private FilePlanService filePlanService; - private RuleService ruleService; /** * Used to check that the node in the context is a fileplan component @@ -61,14 +59,6 @@ public final class FilePlanNamePathDataExtractor extends AbstractDataExtractor this.filePlanService = filePlanService; } - /** - * @param ruleService the ruleService to set - */ - public void setRuleService(RuleService ruleService) - { - this.ruleService = ruleService; - } - /** * @return Returns true if the data is a NodeRef and it represents * a fileplan component @@ -87,34 +77,19 @@ public final class FilePlanNamePathDataExtractor extends AbstractDataExtractor */ public Serializable extractData(Serializable value) { - String extractedData = null; + NodeRef nodeRef = (NodeRef) value; - ruleService.disableRules(); - try - { - NodeRef nodeRef = (NodeRef) value; - StringBuilder sb = new StringBuilder(128); - - if (nodeService.hasAspect(nodeRef, RecordsManagementModel.ASPECT_FILE_PLAN_COMPONENT)) - { - // Get path from the RM root - List nodeRefPath = filePlanService.getNodeRefPath(nodeRef); - - for (NodeRef pathNodeRef : nodeRefPath) - { - String name = (String)nodeService.getProperty(pathNodeRef, ContentModel.PROP_NAME); - sb.append("/").append(name); - } - } + // Get path from the RM root + List nodeRefPath = filePlanService.getNodeRefPath(nodeRef); - // Done - extractedData = sb.toString(); - } - finally + StringBuilder sb = new StringBuilder(128); + for (NodeRef pathNodeRef : nodeRefPath) { - ruleService.enableRules(); + String name = (String)nodeService.getProperty(pathNodeRef, ContentModel.PROP_NAME); + sb.append("/").append(name); } - return extractedData; + // Done + return sb.toString(); } } diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/audit/extractor/FilePlanNodeRefPathDataExtractor.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/audit/extractor/FilePlanNodeRefPathDataExtractor.java index c00c143e5e..5841ab3943 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/audit/extractor/FilePlanNodeRefPathDataExtractor.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/audit/extractor/FilePlanNodeRefPathDataExtractor.java @@ -26,7 +26,6 @@ import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; import org.alfresco.repo.audit.extractor.AbstractDataExtractor; import org.alfresco.service.cmr.repository.NodeRef; import org.alfresco.service.cmr.repository.NodeService; -import org.alfresco.service.cmr.rule.RuleService; /** * An extractor that extracts the NodeRef path from the RM root down to @@ -42,7 +41,6 @@ public final class FilePlanNodeRefPathDataExtractor extends AbstractDataExtracto { private NodeService nodeService; private FilePlanService filePlanService; - private RuleService ruleService; /** * Used to check that the node in the context is a fileplan component @@ -52,22 +50,11 @@ public final class FilePlanNodeRefPathDataExtractor extends AbstractDataExtracto this.nodeService = nodeService; } - /** - * @param filePlanService file plan service - */ public void setFilePlanService(FilePlanService filePlanService) { this.filePlanService = filePlanService; } - /** - * @param ruleService the ruleService to set - */ - public void setRuleService(RuleService ruleService) - { - this.ruleService = ruleService; - } - /** * @return Returns true if the data is a NodeRef and it represents * a fileplan component @@ -83,24 +70,12 @@ public final class FilePlanNodeRefPathDataExtractor extends AbstractDataExtracto public Serializable extractData(Serializable value) { - Serializable extractedData = null; + NodeRef nodeRef = (NodeRef) value; - ruleService.disableRules(); - try - { - NodeRef nodeRef = (NodeRef) value; + // Get path from the RM root + List nodeRefPath = filePlanService.getNodeRefPath(nodeRef); - // Get path from the RM root - List nodeRefPath = filePlanService.getNodeRefPath(nodeRef); - - // Done - extractedData = (Serializable) nodeRefPath; - } - finally - { - ruleService.enableRules(); - } - - return extractedData; + // Done + return (Serializable) nodeRefPath; } } diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/bootstrap/BootstrapImporterModuleComponent.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/bootstrap/BootstrapImporterModuleComponent.java index f204829fe6..1daccbddeb 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/bootstrap/BootstrapImporterModuleComponent.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/bootstrap/BootstrapImporterModuleComponent.java @@ -40,9 +40,6 @@ public class BootstrapImporterModuleComponent extends ImporterModuleComponent /** module patch executer */ private ModulePatchExecuter modulePatchExecuter; - - /** record contributors group bootstrap component */ - private RecordContributorsGroupBootstrapComponent recordContributorsGroupBootstrapComponent; /** * @param nodeService node service @@ -60,14 +57,6 @@ public class BootstrapImporterModuleComponent extends ImporterModuleComponent this.modulePatchExecuter = modulePatchExecuter; } - /** - * @param recordContributorsGroupBootstrapComponent record contributors group bootstrap component - */ - public void setRecordContributorsGroupBootstrapComponent(RecordContributorsGroupBootstrapComponent recordContributorsGroupBootstrapComponent) - { - this.recordContributorsGroupBootstrapComponent = recordContributorsGroupBootstrapComponent; - } - /** * Need to check whether this module has already been executed. * @@ -80,9 +69,6 @@ public class BootstrapImporterModuleComponent extends ImporterModuleComponent if (!nodeService.exists(nodeRef)) { super.executeInternal(); - - // bootstrap the record contributors group - recordContributorsGroupBootstrapComponent.createRecordContributorsGroup(); // init module schema number modulePatchExecuter.initSchemaVersion(); diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/bootstrap/RecordContributorsGroupBootstrapComponent.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/bootstrap/RecordContributorsGroupBootstrapComponent.java deleted file mode 100644 index 14482708b4..0000000000 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/bootstrap/RecordContributorsGroupBootstrapComponent.java +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright (C) 2005-2014 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - */ -package org.alfresco.module.org_alfresco_module_rm.bootstrap; - -import org.alfresco.module.org_alfresco_module_rm.util.AuthenticationUtil; -import org.alfresco.service.cmr.security.AuthorityService; -import org.alfresco.service.cmr.security.AuthorityType; - -/** - * Record contributors group bootstrap component - * - * @author Roy Wetherall - * @since 2.3 - */ -public class RecordContributorsGroupBootstrapComponent -{ - // default record contributors group - public static final String RECORD_CONTRIBUTORS = "RECORD_CONTRIBUTORS"; - public static final String GROUP_RECORD_CONTRIBUTORS = "GROUP_" + RECORD_CONTRIBUTORS; - - /** authority service */ - private AuthorityService authorityService; - - /** authentication utils */ - private AuthenticationUtil authenticationUtil; - - /** - * @param authorityService authority service - */ - public void setAuthorityService(AuthorityService authorityService) - { - this.authorityService = authorityService; - } - - /** - * @param authenticationUtil authentication util - */ - public void setAuthenticationUtil(AuthenticationUtil authenticationUtil) - { - this.authenticationUtil = authenticationUtil; - } - - /** - * Create record contributor group - */ - public void createRecordContributorsGroup() - { - if (!authorityService.authorityExists(GROUP_RECORD_CONTRIBUTORS)) - { - // create record contributors group - authorityService.createAuthority(AuthorityType.GROUP, RECORD_CONTRIBUTORS); - - // add the admin user - authorityService.addAuthority(GROUP_RECORD_CONTRIBUTORS, authenticationUtil.getAdminUserName()); - } - } -} diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/bootstrap/RecordsManagementBootstrap.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/bootstrap/RecordsManagementBootstrap.java index f061d07a4c..295059ead3 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/bootstrap/RecordsManagementBootstrap.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/bootstrap/RecordsManagementBootstrap.java @@ -22,7 +22,6 @@ import org.alfresco.module.org_alfresco_module_rm.admin.RecordsManagementAdminSe import org.alfresco.module.org_alfresco_module_rm.action.impl.SplitEmailAction; import org.alfresco.module.org_alfresco_module_rm.caveat.RMCaveatConfigService; import org.alfresco.module.org_alfresco_module_rm.email.CustomEmailMappingService; -import org.alfresco.repo.action.parameter.NodeParameterSuggesterBootstrap; import org.alfresco.repo.security.authentication.AuthenticationUtil; import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork; import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback; @@ -42,17 +41,6 @@ public class RecordsManagementBootstrap extends AbstractLifecycleBean private RMCaveatConfigService caveatConfigService; private CustomEmailMappingService customEmailMappingService; private RecordsManagementAdminService adminService; - private NodeParameterSuggesterBootstrap suggesterBootstrap; - - public NodeParameterSuggesterBootstrap getSuggesterBootstrap() - { - return suggesterBootstrap; - } - - public void setSuggesterBootstrap(NodeParameterSuggesterBootstrap suggesterBootstrap) - { - this.suggesterBootstrap = suggesterBootstrap; - } public void setTransactionService(TransactionService transactionService) { @@ -96,10 +84,6 @@ public class RecordsManagementBootstrap extends AbstractLifecycleBean // Initialise the custom model adminService.initialiseCustomModel(); - - // Initialize the suggester after the model - // in case it contains namespaces from custom models - suggesterBootstrap.init(); // Initialise the SplitEmailAction SplitEmailAction action = (SplitEmailAction)getApplicationContext().getBean("splitEmail"); diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/capability/RMAfterInvocationProvider.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/capability/RMAfterInvocationProvider.java index 1b4d91b18c..ea88be3e7d 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/capability/RMAfterInvocationProvider.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/capability/RMAfterInvocationProvider.java @@ -35,6 +35,7 @@ import net.sf.acegisecurity.ConfigAttributeDefinition; import net.sf.acegisecurity.afterinvocation.AfterInvocationProvider; import net.sf.acegisecurity.vote.AccessDecisionVoter; +import org.alfresco.model.ContentModel; import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; import org.alfresco.repo.search.SimpleResultSetMetaData; import org.alfresco.repo.search.impl.lucene.PagingLuceneResultSet; @@ -42,17 +43,19 @@ import org.alfresco.repo.search.impl.querymodel.QueryEngineResults; import org.alfresco.repo.security.authentication.AuthenticationUtil; import org.alfresco.repo.security.permissions.PermissionCheckCollection; import org.alfresco.repo.security.permissions.PermissionCheckValue; -import org.alfresco.repo.security.permissions.PermissionCheckedCollection.PermissionCheckedCollectionMixin; import org.alfresco.repo.security.permissions.PermissionCheckedValue; +import org.alfresco.repo.security.permissions.PermissionCheckedCollection.PermissionCheckedCollectionMixin; import org.alfresco.repo.security.permissions.impl.acegi.ACLEntryVoterException; import org.alfresco.repo.security.permissions.impl.acegi.FilteringResultSet; import org.alfresco.service.cmr.repository.AssociationRef; import org.alfresco.service.cmr.repository.ChildAssociationRef; import org.alfresco.service.cmr.repository.NodeRef; import org.alfresco.service.cmr.repository.StoreRef; +import org.alfresco.service.cmr.repository.datatype.DefaultTypeConverter; import org.alfresco.service.cmr.search.LimitBy; import org.alfresco.service.cmr.search.PermissionEvaluationMode; import org.alfresco.service.cmr.search.ResultSet; +import org.alfresco.service.cmr.security.AccessStatus; import org.aopalliance.intercept.MethodInvocation; import org.apache.commons.lang.StringUtils; import org.apache.commons.logging.Log; @@ -76,8 +79,13 @@ public class RMAfterInvocationProvider extends RMSecurityCommon public boolean supports(ConfigAttribute configAttribute) { + boolean supports = false; String attribute = configAttribute.getAttribute(); - return (StringUtils.isNotBlank(attribute) && attribute.startsWith(AFTER_RM)); + if (StringUtils.isNotBlank(attribute) && attribute.startsWith(AFTER_RM)) + { + supports = true; + } + return supports; } @SuppressWarnings("rawtypes") @@ -210,7 +218,8 @@ public class RMAfterInvocationProvider extends RMSecurityCommon { if (logger.isDebugEnabled()) { - logger.debug("Access denied: " + ade.getMessage()); + logger.debug("Access denied"); + ade.printStackTrace(); } throw ade; } @@ -218,7 +227,8 @@ public class RMAfterInvocationProvider extends RMSecurityCommon { if (logger.isDebugEnabled()) { - logger.debug("Access denied by runtime exception: " + re.getMessage()); + logger.debug("Access denied by runtime exception"); + re.printStackTrace(); } throw re; } @@ -287,10 +297,10 @@ public class RMAfterInvocationProvider extends RMSecurityCommon } - @SuppressWarnings("rawtypes") + @SuppressWarnings({"rawtypes" }) private List extractSupportedDefinitions(ConfigAttributeDefinition config) { - List definitions = new ArrayList<>(); + List definitions = new ArrayList(); Iterator iter = config.getConfigAttributes(); while (iter.hasNext()) @@ -327,7 +337,7 @@ public class RMAfterInvocationProvider extends RMSecurityCommon { NodeRef testNodeRef = null; - if (cad.parent) + if (cad.typeString.equals(cad.parent)) { testNodeRef = returnedObject.getParentRef(); } @@ -343,7 +353,7 @@ public class RMAfterInvocationProvider extends RMSecurityCommon continue; } - if (cad.parent && parentReadCheck != AccessDecisionVoter.ACCESS_GRANTED) + if (cad.typeString.equals(cad.parent) && parentReadCheck != AccessDecisionVoter.ACCESS_GRANTED) { throw new AccessDeniedException("Access Denied"); } diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/capability/RMEntryVoter.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/capability/RMEntryVoter.java index a1684e100d..8d0e0597e5 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/capability/RMEntryVoter.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/capability/RMEntryVoter.java @@ -29,13 +29,12 @@ import net.sf.acegisecurity.Authentication; import net.sf.acegisecurity.ConfigAttribute; import net.sf.acegisecurity.vote.AccessDecisionVoter; -import org.alfresco.error.AlfrescoRuntimeException; import org.alfresco.module.org_alfresco_module_rm.capability.policy.ConfigAttributeDefinition; import org.alfresco.module.org_alfresco_module_rm.capability.policy.Policy; import org.alfresco.module.org_alfresco_module_rm.security.RMMethodSecurityInterceptor; -import org.alfresco.module.org_alfresco_module_rm.util.AlfrescoTransactionSupport; -import org.alfresco.module.org_alfresco_module_rm.util.AuthenticationUtil; -import org.alfresco.module.org_alfresco_module_rm.util.TransactionalResourceHelper; +import org.alfresco.repo.security.authentication.AuthenticationUtil; +import org.alfresco.repo.transaction.AlfrescoTransactionSupport; +import org.alfresco.repo.transaction.TransactionalResourceHelper; import org.alfresco.service.cmr.repository.NodeRef; import org.alfresco.service.namespace.NamespacePrefixResolver; import org.aopalliance.intercept.MethodInvocation; @@ -60,15 +59,6 @@ public class RMEntryVoter extends RMSecurityCommon /** Capability Service */ private CapabilityService capabilityService; - - /** Transactional Resource Helper */ - private TransactionalResourceHelper transactionalResourceHelper; - - /** Alfresco transaction support */ - private AlfrescoTransactionSupport alfrescoTransactionSupport; - - /** authentication util */ - private AuthenticationUtil authenticationUtil; /** Policy map */ private Map policies = new HashMap(); @@ -88,30 +78,6 @@ public class RMEntryVoter extends RMSecurityCommon { this.nspr = nspr; } - - /** - * @param transactionalResourceHelper transactional resource helper - */ - public void setTransactionalResourceHelper(TransactionalResourceHelper transactionalResourceHelper) - { - this.transactionalResourceHelper = transactionalResourceHelper; - } - - /** - * @param alfrescoTransactionSupport alfresco transaction support helper - */ - public void setAlfrescoTransactionSupport(AlfrescoTransactionSupport alfrescoTransactionSupport) - { - this.alfrescoTransactionSupport = alfrescoTransactionSupport; - } - - /** - * @param authenticationUtil authentication util - */ - public void setAuthenticationUtil(AuthenticationUtil authenticationUtil) - { - this.authenticationUtil = authenticationUtil; - } /** * Register a policy the voter @@ -164,7 +130,7 @@ public class RMEntryVoter extends RMSecurityCommon MethodInvocation mi = (MethodInvocation)object; - if (transactionalResourceHelper.isResourcePresent("voting")) + if (TransactionalResourceHelper.isResourcePresent("voting")) { if (logger.isDebugEnabled()) { @@ -178,11 +144,11 @@ public class RMEntryVoter extends RMSecurityCommon logger.debug("Method: " + mi.getMethod().getDeclaringClass().getName() + "." + mi.getMethod().getName()); } - alfrescoTransactionSupport.bindResource("voting", true); + AlfrescoTransactionSupport.bindResource("voting", true); try { // The system user can do anything - if (authenticationUtil.isRunAsUserTheSystemUser()) + if (AuthenticationUtil.isRunAsUserTheSystemUser()) { if (logger.isDebugEnabled()) { @@ -199,15 +165,8 @@ public class RMEntryVoter extends RMSecurityCommon return AccessDecisionVoter.ACCESS_ABSTAIN; } - // check we have an instance of a method invocation - if (!(object instanceof MethodInvocation)) - { - // we expect a method invocation - throw new AlfrescoRuntimeException("Passed object is not an instance of MethodInvocation as expected."); - } - - // get information about the method MethodInvocation invocation = (MethodInvocation) object; + Method method = invocation.getMethod(); Class[] params = method.getParameterTypes(); @@ -314,7 +273,7 @@ public class RMEntryVoter extends RMSecurityCommon } finally { - alfrescoTransactionSupport.unbindResource("voting"); + AlfrescoTransactionSupport.unbindResource("voting"); } // all voted to allow @@ -322,12 +281,11 @@ public class RMEntryVoter extends RMSecurityCommon } /** - * Check the capability * - * @param invocation method invocation - * @param params parameters - * @param cad config definition - * @return int evaluation result + * @param invocation + * @param params + * @param cad + * @return */ @SuppressWarnings("rawtypes") private int checkCapability(MethodInvocation invocation, Class[] params, ConfigAttributeDefinition cad) @@ -340,33 +298,29 @@ public class RMEntryVoter extends RMSecurityCommon Capability capability = capabilityService.getCapability(cad.getRequired().getName()); if (capability == null) { - throw new AlfrescoRuntimeException("The capability '" + cad.getRequired().getName() + "' set on method '" + invocation.getMethod().getName() + "' does not exist."); + return AccessDecisionVoter.ACCESS_DENIED; } return capability.hasPermissionRaw(testNodeRef); } /** - * Evaluate policy to determine access * - * @param invocation invocation information - * @param params parameters - * @param cad configuration attribute definition - * @return int policy evaluation + * @param invocation + * @param params + * @param cad + * @return */ @SuppressWarnings("rawtypes") private int checkPolicy(MethodInvocation invocation, Class[] params, ConfigAttributeDefinition cad) { - // try to get the policy Policy policy = policies.get(cad.getPolicyName()); if (policy == null) { - // throw an exception if the policy is invalid - throw new AlfrescoRuntimeException("The policy '" + cad.getPolicyName() + "' set on the method '" + invocation.getMethod().getName() + "' does not exist."); + return AccessDecisionVoter.ACCESS_GRANTED; } else { - // evaluate the policy return policy.evaluate(invocation, params, cad); } } diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/capability/RMPermissionModel.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/capability/RMPermissionModel.java index 12d267d1b2..5911b2bd39 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/capability/RMPermissionModel.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/capability/RMPermissionModel.java @@ -39,90 +39,148 @@ public interface RMPermissionModel * @deprecated as of 2.1.0.3, please use {@link FilePlanRoleService.ROLE_USER} instead */ @Deprecated - String ROLE_NAME_USER = FilePlanRoleService.ROLE_USER; + public static final String ROLE_NAME_USER = FilePlanRoleService.ROLE_USER; /** * @deprecated as of 2.1.0.3, please use {@link FilePlanRoleService.ROLE_POWER_USER} instead */ @Deprecated - String ROLE_NAME_POWER_USER = FilePlanRoleService.ROLE_POWER_USER; + public static final String ROLE_NAME_POWER_USER = FilePlanRoleService.ROLE_POWER_USER; /** * @deprecated as of 2.1.0.3, please use {@link FilePlanRoleService.ROLE_SECURITY_OFFICER} instead */ @Deprecated - String ROLE_NAME_SECURITY_OFFICER = FilePlanRoleService.ROLE_SECURITY_OFFICER; + public static final String ROLE_NAME_SECURITY_OFFICER = FilePlanRoleService.ROLE_SECURITY_OFFICER; /** * @deprecated as of 2.1.0.3, please use {@link FilePlanRoleService.ROLE_RECORDS_MANAGER} instead */ @Deprecated - String ROLE_NAME_RECORDS_MANAGER = FilePlanRoleService.ROLE_RECORDS_MANAGER; + public static final String ROLE_NAME_RECORDS_MANAGER = FilePlanRoleService.ROLE_RECORDS_MANAGER; /** * @deprecated as of 2.1.0.3, please use {@link FilePlanRoleService.ROLE_ADMIN} instead */ @Deprecated - String ROLE_NAME_ADMINISTRATOR = FilePlanRoleService.ROLE_ADMIN; - String ROLE_ADMINISTRATOR = SimplePermissionReference.getPermissionReference(RecordsManagementModel.ASPECT_FILE_PLAN_COMPONENT, FilePlanRoleService.ROLE_ADMIN).toString(); + public static final String ROLE_NAME_ADMINISTRATOR = FilePlanRoleService.ROLE_ADMIN; + public static final String ROLE_ADMINISTRATOR = SimplePermissionReference.getPermissionReference(RecordsManagementModel.ASPECT_FILE_PLAN_COMPONENT, FilePlanRoleService.ROLE_ADMIN).toString(); // Capability permissions + String DECLARE_RECORDS = "DeclareRecords"; + String VIEW_RECORDS = "ViewRecords"; - String CREATE_RECORDS = "CreateRecords"; + String CREATE_MODIFY_DESTROY_FOLDERS = "CreateModifyDestroyFolders"; + String EDIT_RECORD_METADATA = "EditRecordMetadata"; + String EDIT_NON_RECORD_METADATA = "EditNonRecordMetadata"; + String ADD_MODIFY_EVENT_DATES = "AddModifyEventDates"; + String CLOSE_FOLDERS = "CloseFolders"; + String DECLARE_RECORDS_IN_CLOSED_FOLDERS = "DeclareRecordsInClosedFolders"; + String RE_OPEN_FOLDERS = "ReOpenFolders"; + String CYCLE_VITAL_RECORDS = "CycleVitalRecords"; + String PLANNING_REVIEW_CYCLES = "PlanningReviewCycles"; + String UPDATE_TRIGGER_DATES = "UpdateTriggerDates"; + String CREATE_MODIFY_DESTROY_EVENTS = "CreateModifyDestroyEvents"; + String MANAGE_ACCESS_RIGHTS = "ManageAccessRights"; + String MOVE_RECORDS = "MoveRecords"; + String CHANGE_OR_DELETE_REFERENCES = "ChangeOrDeleteReferences"; + String DELETE_LINKS = "DeleteLinks"; + String EDIT_DECLARED_RECORD_METADATA = "EditDeclaredRecordMetadata"; + String MANUALLY_CHANGE_DISPOSITION_DATES = "ManuallyChangeDispositionDates"; + String APPROVE_RECORDS_SCHEDULED_FOR_CUTOFF = "ApproveRecordsScheduledForCutoff"; + String CREATE_MODIFY_RECORDS_IN_CUTOFF_FOLDERS = "CreateModifyRecordsInCutoffFolders"; + String EXTEND_RETENTION_PERIOD_OR_FREEZE = "ExtendRetentionPeriodOrFreeze"; + String UNFREEZE = "Unfreeze"; + String VIEW_UPDATE_REASONS_FOR_FREEZE = "ViewUpdateReasonsForFreeze"; + String DESTROY_RECORDS_SCHEDULED_FOR_DESTRUCTION = "DestroyRecordsScheduledForDestruction"; + String DESTROY_RECORDS = "DestroyRecords"; + String UPDATE_VITAL_RECORD_CYCLE_INFORMATION = "UpdateVitalRecordCycleInformation"; + String UNDECLARE_RECORDS = "UndeclareRecords"; + String DECLARE_AUDIT_AS_RECORD = "DeclareAuditAsRecord"; + String DELETE_AUDIT = "DeleteAudit"; + String CREATE_MODIFY_DESTROY_TIMEFRAMES = "CreateModifyDestroyTimeframes"; + String AUTHORIZE_NOMINATED_TRANSFERS = "AuthorizeNominatedTransfers"; + String EDIT_SELECTION_LISTS = "EditSelectionLists"; + String AUTHORIZE_ALL_TRANSFERS = "AuthorizeAllTransfers"; + String CREATE_MODIFY_DESTROY_FILEPLAN_METADATA = "CreateModifyDestroyFileplanMetadata"; + String CREATE_AND_ASSOCIATE_SELECTION_LISTS = "CreateAndAssociateSelectionLists"; + String ATTACH_RULES_TO_METADATA_PROPERTIES = "AttachRulesToMetadataProperties"; + String CREATE_MODIFY_DESTROY_FILEPLAN_TYPES = "CreateModifyDestroyFileplanTypes"; + String CREATE_MODIFY_DESTROY_RECORD_TYPES = "CreateModifyDestroyRecordTypes"; + String MAKE_OPTIONAL_PARAMETERS_MANDATORY = "MakeOptionalParametersMandatory"; + String MAP_EMAIL_METADATA = "MapEmailMetadata"; + String DELETE_RECORDS = "DeleteRecords"; + String TRIGGER_AN_EVENT = "TriggerAnEvent"; + String CREATE_MODIFY_DESTROY_ROLES = "CreateModifyDestroyRoles"; + String CREATE_MODIFY_DESTROY_USERS_AND_GROUPS = "CreateModifyDestroyUsersAndGroups"; + String PASSWORD_CONTROL = "PasswordControl"; + String ENABLE_DISABLE_AUDIT_BY_TYPES = "EnableDisableAuditByTypes"; + String SELECT_AUDIT_METADATA = "SelectAuditMetadata"; + String DISPLAY_RIGHTS_REPORT = "DisplayRightsReport"; + String ACCESS_AUDIT = "AccessAudit"; + String EXPORT_AUDIT = "ExportAudit"; + String CREATE_MODIFY_DESTROY_REFERENCE_TYPES = "CreateModifyDestroyReferenceTypes"; + String UPDATE_CLASSIFICATION_DATES = "UpdateClassificationDates"; + String CREATE_MODIFY_DESTROY_CLASSIFICATION_GUIDES = "CreateModifyDestroyClassificationGuides"; + String UPGRADE_DOWNGRADE_AND_DECLASSIFY_RECORDS = "UpgradeDowngradeAndDeclassifyRecords"; + String UPDATE_EXEMPTION_CATEGORIES = "UpdateExemptionCategories"; + String MAP_CLASSIFICATION_GUIDE_METADATA = "MapClassificationGuideMetadata"; + String MANAGE_ACCESS_CONTROLS = "ManageAccessControls"; + String CREATE_HOLD = "CreateHold"; String ADD_TO_HOLD = "AddToHold"; String REMOVE_FROM_HOLD = "RemoveFromHold"; -} \ No newline at end of file +} diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/capability/RMSecurityCommon.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/capability/RMSecurityCommon.java index c97016896c..0ed1312e43 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/capability/RMSecurityCommon.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/capability/RMSecurityCommon.java @@ -22,7 +22,6 @@ import java.util.Map; import net.sf.acegisecurity.vote.AccessDecisionVoter; -import org.alfresco.module.org_alfresco_module_rm.capability.impl.ViewRecordsCapability; import org.alfresco.module.org_alfresco_module_rm.caveat.RMCaveatConfigComponent; import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService; import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; @@ -277,7 +276,7 @@ public class RMSecurityCommon implements ApplicationContextAware } else { - AccessStatus result = permissionService.hasPermission(filePlan, ViewRecordsCapability.NAME); + AccessStatus result = permissionService.hasPermission(filePlan, RMPermissionModel.VIEW_RECORDS); transactionCache.put(key, result); return result; } diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/AbstractCapabilityCondition.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/AbstractCapabilityCondition.java index 09d1bec413..b7d400a4e7 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/AbstractCapabilityCondition.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/AbstractCapabilityCondition.java @@ -26,8 +26,8 @@ import org.alfresco.module.org_alfresco_module_rm.freeze.FreezeService; import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; import org.alfresco.module.org_alfresco_module_rm.record.RecordService; import org.alfresco.module.org_alfresco_module_rm.recordfolder.RecordFolderService; -import org.alfresco.module.org_alfresco_module_rm.util.TransactionalResourceHelper; import org.alfresco.repo.security.authentication.AuthenticationUtil; +import org.alfresco.repo.transaction.TransactionalResourceHelper; import org.alfresco.service.cmr.repository.NodeRef; import org.alfresco.service.cmr.repository.NodeService; import org.alfresco.service.cmr.security.PermissionService; @@ -56,9 +56,6 @@ public abstract class AbstractCapabilityCondition implements CapabilityCondition protected FilePlanService filePlanService; protected DispositionService dispositionService; protected RecordFolderService recordFolderService; - - /** transaction resource helper */ - private TransactionalResourceHelper transactionalResourceHelper; /** * @param recordService record service @@ -115,14 +112,6 @@ public abstract class AbstractCapabilityCondition implements CapabilityCondition { this.recordFolderService = recordFolderService; } - - /** - * @param transactionalResourceHelper transactional resource helper - */ - public void setTransactionalResourceHelper(TransactionalResourceHelper transactionalResourceHelper) - { - this.transactionalResourceHelper = transactionalResourceHelper; - } /** * @see org.alfresco.module.org_alfresco_module_rm.capability.declarative.CapabilityCondition#getName() @@ -142,7 +131,7 @@ public abstract class AbstractCapabilityCondition implements CapabilityCondition boolean result = false; // check transaction cache - Map map = transactionalResourceHelper.getMap(KEY_EVALUATE); + Map map = TransactionalResourceHelper.getMap(KEY_EVALUATE); String key = getName() + "|" + nodeRef.toString() + "|" + AuthenticationUtil.getRunAsUser(); if (map.containsKey(key)) { diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/DeclarativeCapability.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/DeclarativeCapability.java index 25dd968865..7017bcae68 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/DeclarativeCapability.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/DeclarativeCapability.java @@ -301,10 +301,10 @@ public class DeclarativeCapability extends AbstractCapability else { // Check we are dealing with a file plan component - if (getFilePlanService().isFilePlanComponent(nodeRef)) + if (getFilePlanService().isFilePlanComponent(nodeRef) == true) { // Check the kind of the object, the permissions and the conditions - if (checkKinds(nodeRef) && checkPermissions(nodeRef) && checkConditions(nodeRef)) + if (checkKinds(nodeRef) == true && checkPermissions(nodeRef) == true && checkConditions(nodeRef) == true) { // Opportunity for child implementations to extend result = evaluateImpl(nodeRef); @@ -319,7 +319,7 @@ public class DeclarativeCapability extends AbstractCapability result = onEvaluate(nodeRef, result); // log access denied to help with debug - if (LOGGER.isDebugEnabled() && AccessDecisionVoter.ACCESS_DENIED == result) + if (LOGGER.isDebugEnabled() == true && AccessDecisionVoter.ACCESS_DENIED == result) { LOGGER.debug("Capability " + getName() + " returned an Access Denied result during evaluation of node " + nodeRef.toString()); } diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/ClosedCapabilityCondition.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/ClosedCapabilityCondition.java index 83f2b9a357..84ae618591 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/ClosedCapabilityCondition.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/ClosedCapabilityCondition.java @@ -22,8 +22,6 @@ import java.util.List; import org.alfresco.model.ContentModel; import org.alfresco.module.org_alfresco_module_rm.capability.declarative.AbstractCapabilityCondition; -import org.alfresco.repo.security.authentication.AuthenticationUtil; -import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork; import org.alfresco.service.cmr.repository.ChildAssociationRef; import org.alfresco.service.cmr.repository.NodeRef; import org.alfresco.service.namespace.RegexQNamePattern; @@ -46,25 +44,17 @@ public class ClosedCapabilityCondition extends AbstractCapabilityCondition } else if (recordService.isRecord(nodeRef)) { - final List assocs = nodeService.getParentAssocs(nodeRef, ContentModel.ASSOC_CONTAINS, RegexQNamePattern.MATCH_ALL); - - result = AuthenticationUtil.runAsSystem(new RunAsWork() + List assocs = nodeService.getParentAssocs(nodeRef, ContentModel.ASSOC_CONTAINS, RegexQNamePattern.MATCH_ALL); + for (ChildAssociationRef assoc : assocs) { - @Override - public Boolean doWork() + NodeRef parent = assoc.getParentRef(); + if (recordFolderService.isRecordFolder(parent) && + recordFolderService.isRecordFolderClosed(parent)) { - for (ChildAssociationRef assoc : assocs) - { - NodeRef parent = assoc.getParentRef(); - if (recordFolderService.isRecordFolder(parent) && recordFolderService.isRecordFolderClosed(parent)) - { - return true; - } - } - return false; + result = true; + break; } - }); - + } } return result; } diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/FillingOnHoldContainerCapabilityCondition.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/FillingOnHoldContainerCapabilityCondition.java deleted file mode 100644 index 391f81d74f..0000000000 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/FillingOnHoldContainerCapabilityCondition.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright (C) 2005-2014 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - */ -package org.alfresco.module.org_alfresco_module_rm.capability.declarative.condition; - -import org.alfresco.module.org_alfresco_module_rm.capability.RMPermissionModel; -import org.alfresco.module.org_alfresco_module_rm.capability.declarative.AbstractCapabilityCondition; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.security.AccessStatus; - -/** - * Filling capability for hold condition. - * - * @author Roy Wetherall - * @since 2.3 - */ -public class FillingOnHoldContainerCapabilityCondition extends AbstractCapabilityCondition -{ - /** - * @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; - NodeRef holdContainer = nodeRef; - - // if we have a file plan, go get the hold container - if (filePlanService.isFilePlan(nodeRef) == true) - { - holdContainer = filePlanService.getHoldContainer(nodeRef); - } - - // ensure we are dealing with a hold container - if (TYPE_HOLD_CONTAINER.equals(nodeService.getType(holdContainer))) - { - if (permissionService.hasPermission(holdContainer, RMPermissionModel.FILE_RECORDS) != AccessStatus.DENIED) - { - result = true; - } - } - - return result; - } -} diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/FrozenCapabilityCondition.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/FrozenCapabilityCondition.java index a7b4e5132a..dd271ed432 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/FrozenCapabilityCondition.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/FrozenCapabilityCondition.java @@ -19,57 +19,27 @@ package org.alfresco.module.org_alfresco_module_rm.capability.declarative.condition; import org.alfresco.module.org_alfresco_module_rm.capability.declarative.AbstractCapabilityCondition; -import org.alfresco.module.org_alfresco_module_rm.hold.HoldService; import org.alfresco.service.cmr.repository.NodeRef; /** - * Indicates whether an item is held or not. - *

- * A hold object is by definition considered to be held. - * * @author Roy Wetherall */ public class FrozenCapabilityCondition extends AbstractCapabilityCondition { - /** indicates whether children should be checked */ - private boolean checkChildren = false; - - /** hold service */ - private HoldService holdService; +private boolean checkChildren = false; - /** - * @param checkChildren true to check children, false otherwise - */ public void setCheckChildren(boolean checkChildren) { this.checkChildren = checkChildren; } - - /** - * @param holdService hold service - */ - public void setHoldService(HoldService holdService) - { - this.holdService = holdService; - } @Override public boolean evaluateImpl(NodeRef nodeRef) { - boolean result = false; - - // check whether we are working with a hold or not - if (holdService.isHold(nodeRef)) + boolean result = freezeService.isFrozen(nodeRef); + if (!result && checkChildren) { - result = true; - } - else - { - result = freezeService.isFrozen(nodeRef); - if (!result && checkChildren) - { - result = freezeService.hasFrozenChildren(nodeRef); - } + result = freezeService.hasFrozenChildren(nodeRef); } return result; } diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/HoldCapabilityCondition.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/HoldCapabilityCondition.java index 1f860ae8d0..9666de3539 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/HoldCapabilityCondition.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/HoldCapabilityCondition.java @@ -62,23 +62,16 @@ public class HoldCapabilityCondition extends AbstractCapabilityCondition { boolean result = false; - if (holdService.isHold(nodeRef)) + List holds = holdService.heldBy(nodeRef, includedInHold); + for (NodeRef hold : holds) { - result = AccessStatus.ALLOWED.equals(permissionService.hasPermission(nodeRef, RMPermissionModel.FILING)); - } - else - { - List holds = holdService.heldBy(nodeRef, includedInHold); - for (NodeRef hold : holds) + // return true as soon as we find one hold we have filling permission on + if (AccessStatus.ALLOWED.equals(permissionService.hasPermission(hold, RMPermissionModel.FILING))) { - // return true as soon as we find one hold we have filling permission on - if (AccessStatus.ALLOWED.equals(permissionService.hasPermission(hold, RMPermissionModel.FILING))) - { - result = true; - break; - } + result = true; + break; } - } + } return result; } diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/capability/impl/ChangeOrDeleteReferencesCapability.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/capability/impl/ChangeOrDeleteReferencesCapability.java index f050fc1ab9..07fb58b887 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/capability/impl/ChangeOrDeleteReferencesCapability.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/capability/impl/ChangeOrDeleteReferencesCapability.java @@ -30,6 +30,16 @@ import org.alfresco.service.cmr.repository.NodeRef; */ public class ChangeOrDeleteReferencesCapability extends DeclarativeCapability { + /** + * @see org.alfresco.module.org_alfresco_module_rm.capability.declarative.DeclarativeCapability#evaluateImpl(org.alfresco.service.cmr.repository.NodeRef) + */ + @Override + protected int evaluateImpl(NodeRef nodeRef) + { + // Can't be sure, because we don't have information about the target so we still abstain + return AccessDecisionVoter.ACCESS_ABSTAIN; + } + /** * @see org.alfresco.module.org_alfresco_module_rm.capability.AbstractCapability#evaluate(org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.cmr.repository.NodeRef) */ diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/capability/impl/CreateCapability.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/capability/impl/CreateCapability.java index e05aebda12..77e2f8cc6d 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/capability/impl/CreateCapability.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/capability/impl/CreateCapability.java @@ -94,7 +94,7 @@ public class CreateCapability extends DeclarativeCapability { if (linkee == null) { - if (recordService.isRecord(destination) && + if (recordService.isRecord(destination) && !recordService.isDeclared(destination) && permissionService.hasPermission(destination, RMPermissionModel.FILE_RECORDS) == AccessStatus.ALLOWED) { @@ -121,13 +121,6 @@ public class CreateCapability extends DeclarativeCapability conditions.put("capabilityCondition.closed", Boolean.FALSE); conditions.put("capabilityCondition.cutoff", Boolean.FALSE); - // if the destination folder is not a record folder and the user has filling capability on it, grant access to create the record - if (checkConditions(destination, conditions) && - !recordFolderService.isRecordFolder(destination) ) - { - return AccessDecisionVoter.ACCESS_GRANTED; - } - if (checkConditions(destination, conditions) && recordFolderService.isRecordFolder(destination) && permissionService.hasPermission(destination, RMPermissionModel.FILE_RECORDS) == AccessStatus.ALLOWED) diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/capability/impl/EditNonRecordMetadataCapability.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/capability/impl/EditNonRecordMetadataCapability.java deleted file mode 100644 index fa1cc976c6..0000000000 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/capability/impl/EditNonRecordMetadataCapability.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright (C) 2005-2014 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - */ -package org.alfresco.module.org_alfresco_module_rm.capability.impl; - -import net.sf.acegisecurity.vote.AccessDecisionVoter; - -import org.alfresco.module.org_alfresco_module_rm.capability.declarative.DeclarativeCapability; -import org.alfresco.module.org_alfresco_module_rm.record.RecordServiceImpl; -import org.alfresco.module.org_alfresco_module_rm.util.TransactionalResourceHelper; -import org.alfresco.service.cmr.repository.NodeRef; - -/** - * Edit non record metadata capability - * - * @author Roy Wetherall - * @since 2.3 - */ -public class EditNonRecordMetadataCapability extends DeclarativeCapability -{ - /** transaction resource helper */ - private TransactionalResourceHelper transactionalResourceHelper; - - /** - * @param transactionalResourceHelper transaction resource helper - */ - public void setTransactionalResourceHelper(TransactionalResourceHelper transactionalResourceHelper) - { - this.transactionalResourceHelper = transactionalResourceHelper; - } - - @Override - public int evaluate(NodeRef nodeRef) - { - // check if this node is a new record - if (transactionalResourceHelper.getSet(RecordServiceImpl.KEY_NEW_RECORDS).contains(nodeRef)) - { - // since this is a new record created within this transaction, ignore the usual capability check - // under the assumption that the user has CreateRecord - // @see https://issues.alfresco.com/jira/browse/RM-1956 - return AccessDecisionVoter.ACCESS_GRANTED; - } - - return super.evaluate(nodeRef); - } - - -} \ No newline at end of file diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/capability/policy/AssocPolicy.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/capability/policy/AssocPolicy.java index 0db6c2f053..657831e395 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/capability/policy/AssocPolicy.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/capability/policy/AssocPolicy.java @@ -18,7 +18,7 @@ */ package org.alfresco.module.org_alfresco_module_rm.capability.policy; -import org.alfresco.module.org_alfresco_module_rm.capability.impl.ViewRecordsCapability; +import org.alfresco.module.org_alfresco_module_rm.capability.RMPermissionModel; import org.alfresco.service.cmr.repository.NodeRef; import org.aopalliance.intercept.MethodInvocation; @@ -32,7 +32,7 @@ public class AssocPolicy extends AbstractBasePolicy ConfigAttributeDefinition cad) { NodeRef testNodeRef = getTestNode(invocation, params, cad.getParameters().get(0), cad.isParent()); - return getCapabilityService().getCapability(ViewRecordsCapability.NAME).evaluate(testNodeRef); + return getCapabilityService().getCapability(RMPermissionModel.VIEW_RECORDS).evaluate(testNodeRef); } } \ No newline at end of file diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/capability/policy/ReadPolicy.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/capability/policy/ReadPolicy.java index d86971029e..decc5e51e2 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/capability/policy/ReadPolicy.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/capability/policy/ReadPolicy.java @@ -18,7 +18,7 @@ */ package org.alfresco.module.org_alfresco_module_rm.capability.policy; -import org.alfresco.module.org_alfresco_module_rm.capability.impl.ViewRecordsCapability; +import org.alfresco.module.org_alfresco_module_rm.capability.RMPermissionModel; import org.alfresco.service.cmr.repository.NodeRef; import org.aopalliance.intercept.MethodInvocation; @@ -38,6 +38,6 @@ public class ReadPolicy extends AbstractBasePolicy ConfigAttributeDefinition cad) { NodeRef testNodeRef = getTestNode(invocation, params, cad.getParameters().get(0), cad.isParent()); - return getCapabilityService().getCapability(ViewRecordsCapability.NAME).evaluate(testNodeRef); + return getCapabilityService().getCapability(RMPermissionModel.VIEW_RECORDS).evaluate(testNodeRef); } } \ No newline at end of file diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/capability/policy/UpdatePropertiesPolicy.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/capability/policy/UpdatePropertiesPolicy.java index 02f30dbc1b..4cfa0cbca1 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/capability/policy/UpdatePropertiesPolicy.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/capability/policy/UpdatePropertiesPolicy.java @@ -32,4 +32,5 @@ public class UpdatePropertiesPolicy extends AbstractBasePolicy NodeRef nodeRef = getTestNode(invocation, params, cad.getParameters().get(0), cad.isParent()); return getCapabilityService().getCapability("UpdateProperties").evaluate(nodeRef); } + } \ No newline at end of file diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/caveat/RMCaveatConfigComponentImpl.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/caveat/RMCaveatConfigComponentImpl.java index 84f39925c5..ea46bcbe21 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/caveat/RMCaveatConfigComponentImpl.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/caveat/RMCaveatConfigComponentImpl.java @@ -18,8 +18,6 @@ */ package org.alfresco.module.org_alfresco_module_rm.caveat; -import static org.apache.commons.lang.exception.ExceptionUtils.getFullStackTrace; - import java.io.File; import java.io.InputStream; import java.io.Serializable; @@ -994,58 +992,31 @@ public class RMCaveatConfigComponentImpl implements ContentServicePolicies.OnCon */ private String convertToJSONString(SimpleCache>> config) { - JSONObject configJSONObject = new JSONObject(); + JSONObject obj = new JSONObject(); - Collection listNames = config.getKeys(); - for (String listName : listNames) + try { - Map> members = config.get(listName); - - Set authorityNames = members.keySet(); - JSONObject listMembers = new JSONObject(); - - for (String authorityName : authorityNames) + Collection listNames = config.getKeys(); + for(String listName : listNames) { - List authorities = members.get(authorityName); - try + Map> members = config.get(listName); + + Set authorityNames = members.keySet(); + JSONObject listMembers = new JSONObject(); + + for(String authorityName : authorityNames) { - listMembers.put(authorityName, authorities); + listMembers.put(authorityName, members.get(authorityName)); } - catch (JSONException error) - { - StringBuilder sb = new StringBuilder(); - sb.append("Cannot add the key '"); - sb.append(authorityName); - sb.append("' with the value '"); - sb.append(authorities); - sb.append("' to the JSONObject 'listMembers' '"); - sb.append(listMembers); - sb.append("': "); - sb.append(getFullStackTrace(error)); - throw new AlfrescoRuntimeException(sb.toString()); - } - } - try - { - configJSONObject.put(listName, listMembers); - } - catch (JSONException error) - { - StringBuilder sb = new StringBuilder(); - sb.append("Cannot add the key '"); - sb.append(listName); - sb.append("' with the value '"); - sb.append(listMembers); - sb.append("' to the JSONObject 'configJSONObject' '"); - sb.append(configJSONObject); - sb.append("': "); - sb.append(getFullStackTrace(error)); - throw new AlfrescoRuntimeException(sb.toString()); + obj.put(listName, listMembers); } } - - return configJSONObject.toString(); + catch (JSONException je) + { + throw new AlfrescoRuntimeException("Invalid caveat config syntax: "+ je); + } + return obj.toString(); } /** diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/caveat/RMCaveatConfigServiceImpl.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/caveat/RMCaveatConfigServiceImpl.java index b3e201d098..b4c4c76fb6 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/caveat/RMCaveatConfigServiceImpl.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/caveat/RMCaveatConfigServiceImpl.java @@ -30,7 +30,6 @@ import java.util.UUID; import org.alfresco.error.AlfrescoRuntimeException; import org.alfresco.module.org_alfresco_module_rm.admin.RecordsManagementAdminService; import org.alfresco.module.org_alfresco_module_rm.caveat.RMListOfValuesConstraint.MatchLogic; -import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementCustomModel; import org.alfresco.repo.security.authentication.AuthenticationUtil; import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork; import org.alfresco.service.cmr.dictionary.Constraint; @@ -131,14 +130,11 @@ public class RMCaveatConfigServiceImpl implements RMCaveatConfigService public RMConstraintInfo addRMConstraint(String listName, String title, String[] values, MatchLogic matchLogic) { - if (listName == null) + if(listName == null) { // Generate a list name - StringBuilder sb = new StringBuilder(); - sb.append(RecordsManagementCustomModel.RM_CUSTOM_PREFIX); - sb.append(QName.NAMESPACE_PREFIX); - sb.append(UUID.randomUUID().toString()); - listName = sb.toString(); + // FIXME: hardcoded namespace + listName = "rmc:" + UUID.randomUUID().toString(); } ListallowedValues = new ArrayList(); diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/dataset/DataSetServiceImpl.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/dataset/DataSetServiceImpl.java index 54ce6c8c74..28c32fe0cb 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/dataset/DataSetServiceImpl.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/dataset/DataSetServiceImpl.java @@ -386,7 +386,7 @@ public class DataSetServiceImpl implements DataSetService, RecordsManagementMode } // Make sure all the containers do not inherit permissions - ResultSet rs = searchService.query(SPACES_STORE, SearchService.LANGUAGE_FTS_ALFRESCO, + ResultSet rs = searchService.query(SPACES_STORE, SearchService.LANGUAGE_LUCENE, "TYPE:\"rma:recordsManagementContainer\""); try { @@ -412,7 +412,7 @@ public class DataSetServiceImpl implements DataSetService, RecordsManagementMode // fix up the test dataset to fire initial events for // disposition // schedules - rs = searchService.query(SPACES_STORE, SearchService.LANGUAGE_FTS_ALFRESCO, "TYPE:\"rma:recordFolder\""); + rs = searchService.query(SPACES_STORE, SearchService.LANGUAGE_LUCENE, "TYPE:\"rma:recordFolder\""); try { logger.info("Bootstraping " + rs.length() + " record folders ..."); diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/disposition/DispositionServiceImpl.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/disposition/DispositionServiceImpl.java index 05b994a87b..3883e7a097 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/disposition/DispositionServiceImpl.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/disposition/DispositionServiceImpl.java @@ -969,7 +969,7 @@ public class DispositionServiceImpl extends ServiceBaseImpl * @see org.alfresco.module.org_alfresco_module_rm.disposition.DispositionService#cutoffDisposableItem(NodeRef) */ @Override - public void cutoffDisposableItem(final NodeRef nodeRef) + public void cutoffDisposableItem(NodeRef nodeRef) { ParameterCheck.mandatory("nodeRef", nodeRef); @@ -1001,21 +1001,9 @@ public class DispositionServiceImpl extends ServiceBaseImpl if (recordFolderService.isRecordFolder(nodeRef) && !recordFolderService.isRecordFolderClosed(nodeRef)) { - // runAs system so that we can close a record that has already been cutoff - authenticationUtil.runAsSystem(new RunAsWork() - { - public Void doWork() throws Exception - { - recordFolderService.closeRecordFolder(nodeRef); - return null; - } - }); + recordFolderService.closeRecordFolder(nodeRef); } } - else - { - throw new AlfrescoRuntimeException("unable to perform cutoff, because node is frozen or has frozen children"); - } } else { diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/event/OnReferencedRecordActionedUpon.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/event/OnReferencedRecordActionedUpon.java index 37f039aeb2..5d3e04ece1 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/event/OnReferencedRecordActionedUpon.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/event/OnReferencedRecordActionedUpon.java @@ -24,9 +24,9 @@ import java.util.HashMap; import java.util.List; import java.util.Map; -import org.alfresco.module.org_alfresco_module_rm.RecordsManagementPolicies.BeforeRMActionExecution; import org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementActionService; import org.alfresco.module.org_alfresco_module_rm.action.impl.CompleteEventAction; +import org.alfresco.module.org_alfresco_module_rm.admin.RecordsManagementAdminService; import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionAction; import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionService; import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; @@ -51,8 +51,7 @@ import org.alfresco.service.namespace.RegexQNamePattern; */ @BehaviourBean public class OnReferencedRecordActionedUpon extends SimpleRecordsManagementEventTypeImpl - implements RecordsManagementModel, - BeforeRMActionExecution + implements RecordsManagementModel { /** Disposition service */ @@ -61,6 +60,9 @@ public class OnReferencedRecordActionedUpon extends SimpleRecordsManagementEvent /** Records management action service */ private RecordsManagementActionService recordsManagementActionService; + /** Records management admin service */ + private RecordsManagementAdminService recordsManagementAdminService; + /** Node service */ private NodeService nodeService; @@ -92,6 +94,14 @@ public class OnReferencedRecordActionedUpon extends SimpleRecordsManagementEvent this.recordsManagementActionService = recordsManagementActionService; } + /** + * @param recordsManagementAdminService record management admin service + */ + public void setRecordsManagementAdminService(RecordsManagementAdminService recordsManagementAdminService) + { + this.recordsManagementAdminService = recordsManagementAdminService; + } + /** * @param nodeService node service */ @@ -148,14 +158,13 @@ public class OnReferencedRecordActionedUpon extends SimpleRecordsManagementEvent * @param name * @param parameters */ - @Override @Behaviour ( kind = BehaviourKind.CLASS, type = "rma:filePlanComponent", notificationFrequency = NotificationFrequency.FIRST_EVENT ) - public void beforeRMActionExecution(final NodeRef nodeRef, final String name, final Map parameters) + public void beforeActionExecution(final NodeRef nodeRef, final String name, final Map parameters) { AuthenticationUtil.RunAsWork work = new AuthenticationUtil.RunAsWork() { @@ -203,7 +212,7 @@ public class OnReferencedRecordActionedUpon extends SimpleRecordsManagementEvent private void processRecord(NodeRef record) { - List fromAssocs = nodeService.getTargetAssocs(record, RegexQNamePattern.MATCH_ALL); + List fromAssocs = recordsManagementAdminService.getCustomReferencesFrom(record); for (AssociationRef fromAssoc : fromAssocs) { if (reference.equals(fromAssoc.getTypeQName())) @@ -213,7 +222,7 @@ public class OnReferencedRecordActionedUpon extends SimpleRecordsManagementEvent } } - List toAssocs = nodeService.getSourceAssocs(record, RegexQNamePattern.MATCH_ALL); + List toAssocs = recordsManagementAdminService.getCustomReferencesTo(record); for (AssociationRef toAssoc : toAssocs) { if (reference.equals(toAssoc.getTypeQName())) diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/fileplan/FilePlanServiceImpl.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/fileplan/FilePlanServiceImpl.java index 111212b7a4..e762489f77 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/fileplan/FilePlanServiceImpl.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/fileplan/FilePlanServiceImpl.java @@ -65,6 +65,7 @@ public class FilePlanServiceImpl extends ServiceBaseImpl private static final String MSG_DUP_ROOT = "rm.service.dup-root"; private static final String MSG_ROOT_TYPE = "rm.service.root-type"; private static final String MSG_PATH_NODE = "rm.service.path-node"; + private static final String MSG_INVALID_RM_NODE = "rm.service.invalid-rm-node"; private static final String MSG_NO_ROOT = "rm.service.no-root"; private static final String MSG_CONTAINER_PARENT_TYPE= "rm.service.container-parent-type"; private static final String MSG_CONTAINER_TYPE = "rm.service.container-type"; @@ -100,11 +101,17 @@ public class FilePlanServiceImpl extends ServiceBaseImpl */ public FilePlanRoleService getFilePlanRoleService() { - if (filePlanRoleService == null) - { - filePlanRoleService = (FilePlanRoleService) applicationContext.getBean("FilePlanRoleService"); - } - return filePlanRoleService; + return this.filePlanRoleService; + } + + /** + * Sets the file plan role service + * + * @param filePlanRoleService The file plan role service + */ + public void setFilePlanRoleService(FilePlanRoleService filePlanRoleService) + { + this.filePlanRoleService = filePlanRoleService; } /** @@ -114,11 +121,17 @@ public class FilePlanServiceImpl extends ServiceBaseImpl */ public PermissionService getPermissionService() { - if (permissionService == null) - { - permissionService = (PermissionService) applicationContext.getBean("permissionService"); - } - return permissionService; + return this.permissionService; + } + + /** + * Sets the permission service + * + * @param permissionService The permission service + */ + public void setPermissionService(PermissionService permissionService) + { + this.permissionService = permissionService; } /** @@ -128,11 +141,17 @@ public class FilePlanServiceImpl extends ServiceBaseImpl */ public NodeDAO getNodeDAO() { - if (nodeDAO == null) - { - nodeDAO = (NodeDAO) applicationContext.getBean("nodeDAO"); - } - return nodeDAO; + return this.nodeDAO; + } + + /** + * Sets the node DAO + * + * @param nodeDAO The node DAO + */ + public void setNodeDAO(NodeDAO nodeDAO) + { + this.nodeDAO = nodeDAO; } /** @@ -142,11 +161,17 @@ public class FilePlanServiceImpl extends ServiceBaseImpl */ public SiteService getSiteService() { - if (siteService == null) - { - siteService = (SiteService) applicationContext.getBean("SiteService"); - } - return siteService; + return this.siteService; + } + + /** + * Sets the site service + * + * @param siteService The site service + */ + public void setSiteService(SiteService siteService) + { + this.siteService = siteService; } /** @@ -347,7 +372,7 @@ public class FilePlanServiceImpl extends ServiceBaseImpl containerType, properties).getChildRef(); - // if (!inheritPermissions) + // if (inheritPermissions == false) // { // set inheritance to false getPermissionService().setInheritParentPermissions(container, false); @@ -459,23 +484,24 @@ public class FilePlanServiceImpl extends ServiceBaseImpl */ private void getNodeRefPathRecursive(NodeRef nodeRef, Deque nodeRefPath) { - if (isFilePlanComponent(nodeRef)) + if (!isFilePlanComponent(nodeRef)) { - // Prepend it to the path - nodeRefPath.addFirst(nodeRef); - // Are we not at the root - if (!isFilePlan(nodeRef)) + throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_INVALID_RM_NODE, ASPECT_FILE_PLAN_COMPONENT.toString())); + } + // Prepend it to the path + nodeRefPath.addFirst(nodeRef); + // Are we not at the root + if (!isFilePlan(nodeRef)) + { + ChildAssociationRef assocRef = nodeService.getPrimaryParent(nodeRef); + if (assocRef == null) { - ChildAssociationRef assocRef = nodeService.getPrimaryParent(nodeRef); - if (assocRef == null) - { - // We hit the top of the store - throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_NO_ROOT)); - } - // Recurse - nodeRef = assocRef.getParentRef(); - getNodeRefPathRecursive(nodeRef, nodeRefPath); + // We hit the top of the store + throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_NO_ROOT)); } + // Recurse + nodeRef = assocRef.getParentRef(); + getNodeRefPathRecursive(nodeRef, nodeRefPath); } } diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/forms/RecordsManagementNodeFormFilter.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/forms/RecordsManagementNodeFormFilter.java index 1572905e19..389fb05a39 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/forms/RecordsManagementNodeFormFilter.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/forms/RecordsManagementNodeFormFilter.java @@ -18,8 +18,6 @@ */ package org.alfresco.module.org_alfresco_module_rm.forms; -import static org.alfresco.repo.security.authentication.AuthenticationUtil.runAsSystem; - import java.io.Serializable; import java.util.List; import java.util.Map; @@ -43,7 +41,6 @@ import org.alfresco.repo.forms.processor.node.FieldUtils; import org.alfresco.repo.forms.processor.node.FormFieldConstants; import org.alfresco.repo.i18n.StaticMessageLookup; import org.alfresco.repo.security.authentication.AuthenticationUtil; -import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork; import org.alfresco.service.cmr.dictionary.AspectDefinition; import org.alfresco.service.cmr.dictionary.DataTypeDefinition; import org.alfresco.service.cmr.dictionary.PropertyDefinition; @@ -261,23 +258,14 @@ public class RecordsManagementNodeFormFilter extends RecordsManagementFormFilter * @param form * @param nodeRef */ - protected void addTransientProperties(Form form, final NodeRef nodeRef) + protected void addTransientProperties(Form form, NodeRef nodeRef) { if (recordService.isRecord(nodeRef)) { addTransientPropertyField(form, TRANSIENT_DECLARED, DataTypeDefinition.BOOLEAN, recordService.isDeclared(nodeRef)); } - // Need to get the disposition schedule as the system user. See RM-1727. - DispositionSchedule ds = runAsSystem(new RunAsWork() - { - @Override - public DispositionSchedule doWork() - { - return getDispositionService().getDispositionSchedule(nodeRef); - } - }); - + DispositionSchedule ds = getDispositionService().getDispositionSchedule(nodeRef); if (ds != null) { String instructions = ds.getDispositionInstructions(); diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/hold/HoldService.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/hold/HoldService.java index d7e2589c54..b0e8821e7a 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/hold/HoldService.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/hold/HoldService.java @@ -68,7 +68,7 @@ public interface HoldService /** * Gets the list of item node references which are in the given hold * - * @param hold {@link NodeRef} of the hold + * @param ndoeRef {@link NodeRef} of the hold * @return Lost of item {@link NodeRef}s which are in the given hold */ List getHeld(NodeRef hold); diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/hold/HoldServiceImpl.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/hold/HoldServiceImpl.java index 68f57529bd..22ea92d531 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/hold/HoldServiceImpl.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/hold/HoldServiceImpl.java @@ -73,7 +73,7 @@ public class HoldServiceImpl extends ServiceBaseImpl { /** Logger */ private static Log logger = LogFactory.getLog(HoldServiceImpl.class); - + /** Audit event keys */ private static final String AUDIT_ADD_TO_HOLD = "addToHold"; private static final String AUDIT_REMOVE_FROM_HOLD = "removeFromHold"; @@ -89,7 +89,7 @@ public class HoldServiceImpl extends ServiceBaseImpl /** Permission service */ private PermissionService permissionService; - + /** records management audit service */ private RecordsManagementAuditService recordsManagementAuditService; @@ -142,7 +142,7 @@ public class HoldServiceImpl extends ServiceBaseImpl { this.permissionService = permissionService; } - + /** * @param recordsManagementAuditService records management audit service */ @@ -150,7 +150,7 @@ public class HoldServiceImpl extends ServiceBaseImpl { this.recordsManagementAuditService = recordsManagementAuditService; } - + /** * Initialise hold service */ @@ -195,7 +195,7 @@ public class HoldServiceImpl extends ServiceBaseImpl }; // run as system user - authenticationUtil.runAsSystem(work); + runAsSystem(work); } } @@ -256,7 +256,7 @@ public class HoldServiceImpl extends ServiceBaseImpl for (ChildAssociationRef holdAssoc : holdsAssocs) { NodeRef hold = holdAssoc.getChildRef(); - if (isHold(hold)) + if (isHold(hold)) { // add to list of holds holds.add(hold); @@ -471,7 +471,7 @@ public class HoldServiceImpl extends ServiceBaseImpl } catch (AccessDeniedException ade) { - throw new AlfrescoRuntimeException("Can't delete hold, because you don't have filling permissions on all the items held within the hold.", ade); + throw new AlfrescoRuntimeException("Can't delete hold, because you don't have filling permissions on all the items held within the hold."); } } @@ -561,7 +561,7 @@ public class HoldServiceImpl extends ServiceBaseImpl if (!getHeld(hold).contains(nodeRef)) { // run as system to ensure we have all the appropriate permissions to perform the manipulations we require - authenticationUtil.runAsSystem(new RunAsWork() + runAsSystem(new RunAsWork() { @Override public Void doWork() @@ -586,7 +586,7 @@ public class HoldServiceImpl extends ServiceBaseImpl // Link the record to the hold nodeService.addChild(hold, nodeRef, ASSOC_FROZEN_RECORDS, ASSOC_FROZEN_RECORDS); - + // audit item being added to the hold recordsManagementAuditService.auditEvent(nodeRef, AUDIT_ADD_TO_HOLD); @@ -684,26 +684,26 @@ public class HoldServiceImpl extends ServiceBaseImpl { // run as system so we don't run into further permission issues // we already know we have to have the correct capability to get here - authenticationUtil.runAsSystem(new RunAsWork() + runAsSystem(new RunAsWork() { @Override public Void doWork() { // remove from hold nodeService.removeChild(hold, nodeRef); - + // audit that the node has been remove from the hold // TODO add details of the hold that the node was removed from recordsManagementAuditService.auditEvent(nodeRef, AUDIT_REMOVE_FROM_HOLD); - + return null; } - }); + }); } } // run as system as we can't be sure if have remove aspect rights on node - authenticationUtil.runAsSystem(new RunAsWork() + runAsSystem(new RunAsWork() { @Override public Void doWork() diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/job/DispositionLifecycleJobExecuter.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/job/DispositionLifecycleJobExecuter.java index 94ada57f76..272375cc2f 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/job/DispositionLifecycleJobExecuter.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/job/DispositionLifecycleJobExecuter.java @@ -114,8 +114,8 @@ public class DispositionLifecycleJobExecuter extends RecordsManagementJobExecute { StringBuilder sb = new StringBuilder(); - sb.append("TYPE:\"rma:dispositionAction\" + "); - sb.append("(@rma\\:dispositionAction:("); + sb.append("+TYPE:\"rma:dispositionAction\" "); + sb.append("+(@rma\\:dispositionAction:("); boolean bFirst = true; for (String dispositionAction : dispositionActions) @@ -133,8 +133,8 @@ public class DispositionLifecycleJobExecuter extends RecordsManagementJobExecute } sb.append("))"); - sb.append(" AND ISNULL:\"rma:dispositionActionCompletedAt\" "); - sb.append(" + ( "); + sb.append("+ISNULL:\"rma:dispositionActionCompletedAt\" "); + sb.append("+( "); sb.append("@rma\\:dispositionEventsEligible:true "); sb.append("OR @rma\\:dispositionAsOf:[MIN TO NOW] "); sb.append(") "); @@ -157,7 +157,7 @@ public class DispositionLifecycleJobExecuter extends RecordsManagementJobExecute if (dispositionActions != null && !dispositionActions.isEmpty()) { // execute search - ResultSet results = searchService.query(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, SearchService.LANGUAGE_FTS_ALFRESCO, getQuery()); + ResultSet results = searchService.query(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, SearchService.LANGUAGE_LUCENE, getQuery()); List resultNodes = results.getNodeRefs(); results.close(); diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/job/NotifyOfRecordsDueForReviewJobExecuter.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/job/NotifyOfRecordsDueForReviewJobExecuter.java index 61bf37c158..3297f7b3ee 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/job/NotifyOfRecordsDueForReviewJobExecuter.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/job/NotifyOfRecordsDueForReviewJobExecuter.java @@ -91,7 +91,7 @@ public class NotifyOfRecordsDueForReviewJobExecuter extends RecordsManagementJob queryBuffer.append(") "); String query = queryBuffer.toString(); - ResultSet results = searchService.query(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, SearchService.LANGUAGE_FTS_ALFRESCO, query); + ResultSet results = searchService.query(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, SearchService.LANGUAGE_LUCENE, query); final List resultNodes = results.getNodeRefs(); results.close(); diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/job/PublishUpdatesJobExecuter.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/job/PublishUpdatesJobExecuter.java index ff5a985dad..c2580aebcf 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/job/PublishUpdatesJobExecuter.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/job/PublishUpdatesJobExecuter.java @@ -34,9 +34,7 @@ import org.alfresco.service.cmr.dictionary.DictionaryService; import org.alfresco.service.cmr.repository.NodeRef; import org.alfresco.service.cmr.repository.NodeService; import org.alfresco.service.cmr.repository.StoreRef; -import org.alfresco.service.cmr.search.QueryConsistency; import org.alfresco.service.cmr.search.ResultSet; -import org.alfresco.service.cmr.search.SearchParameters; import org.alfresco.service.cmr.search.SearchService; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -99,12 +97,12 @@ public class PublishUpdatesJobExecuter extends RecordsManagementJobExecuter } /** - * @param dictionaryService dictionary service + * @param dictionaryService dictionary service */ public void setDictionaryService(DictionaryService dictionaryService) { - this.dictionaryService = dictionaryService; - } + this.dictionaryService = dictionaryService; + } /** * @see org.alfresco.module.org_alfresco_module_rm.job.RecordsManagementJobExecuter#executeImpl() @@ -130,41 +128,37 @@ public class PublishUpdatesJobExecuter extends RecordsManagementJobExecuter { if (nodeService.exists(nodeRef)) { - boolean publishing = ((Boolean)nodeService.getProperty(nodeRef, PROP_PUBLISH_IN_PROGRESS)).booleanValue(); - if (!publishing) + // Mark the update node as publishing in progress + markPublishInProgress(nodeRef); + try { - // Mark the update node as publishing in progress - markPublishInProgress(nodeRef); - try + Date start = new Date(); + if (logger.isDebugEnabled()) { - Date start = new Date(); - if (logger.isDebugEnabled()) - { - logger.debug("Starting publish of updates ..."); - logger.debug(" - for " + nodeRef.toString()); - logger.debug(" - at " + start.toString()); - } - - // Publish updates - publishUpdates(nodeRef); - - - if (logger.isDebugEnabled()) - { - Date end = new Date(); - long duration = end.getTime() - start.getTime(); - logger.debug("Completed publish of updates ..."); - logger.debug(" - for " + nodeRef.toString()); - logger.debug(" - at " + end.toString()); - logger.debug(" - duration " + Long.toString(duration)); - } + logger.debug("Starting publish of updates ..."); + logger.debug(" - for " + nodeRef.toString()); + logger.debug(" - at " + start.toString()); } - finally + + // Publish updates + publishUpdates(nodeRef); + + + if (logger.isDebugEnabled()) { - // Ensure the update node has either completed the publish or is marked as no longer in progress - unmarkPublishInProgress(nodeRef); + Date end = new Date(); + long duration = end.getTime() - start.getTime(); + logger.debug("Completed publish of updates ..."); + logger.debug(" - for " + nodeRef.toString()); + logger.debug(" - at " + end.toString()); + logger.debug(" - duration " + Long.toString(duration)); } } + finally + { + // Ensure the update node has either completed the publish or is marked as no longer in progress + unmarkPublishInProgress(nodeRef); + } } } } @@ -189,7 +183,7 @@ public class PublishUpdatesJobExecuter extends RecordsManagementJobExecuter // ensure that the rm content model has been loaded if (dictionaryService != null && - dictionaryService.getAspect(ASPECT_UNPUBLISHED_UPDATE) != null) + dictionaryService.getAspect(ASPECT_UNPUBLISHED_UPDATE) != null) { result = true; } @@ -211,7 +205,8 @@ public class PublishUpdatesJobExecuter extends RecordsManagementJobExecuter { // Build the query string StringBuilder sb = new StringBuilder(); - sb.append("ASPECT:\"rma:").append(ASPECT_UNPUBLISHED_UPDATE.getLocalName()).append("\""); + sb.append("+ASPECT:\"rma:").append(ASPECT_UNPUBLISHED_UPDATE.getLocalName()).append("\" "); + sb.append("@rma\\:").append(PROP_PUBLISH_IN_PROGRESS.getLocalName()).append(":false "); String query = sb.toString(); if (logger.isDebugEnabled()) @@ -221,16 +216,10 @@ public class PublishUpdatesJobExecuter extends RecordsManagementJobExecuter // Execute query to find updates awaiting publishing List resultNodes = null; - - SearchParameters searchParameters = new SearchParameters(); - searchParameters.setQueryConsistency(QueryConsistency.TRANSACTIONAL); - searchParameters.setQuery(query); - searchParameters.addStore(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE); - searchParameters.setLanguage(SearchService.LANGUAGE_FTS_ALFRESCO); - - try - { - ResultSet results = searchService.query(searchParameters); + ResultSet results = searchService.query( + StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, + SearchService.LANGUAGE_LUCENE, + query); try { resultNodes = results.getNodeRefs(); @@ -239,15 +228,6 @@ public class PublishUpdatesJobExecuter extends RecordsManagementJobExecuter { results.close(); } - } - catch (AlfrescoRuntimeException exception) - { - if (logger.isDebugEnabled()) - { - logger.debug("Error executing query, " + exception.getMessage()); - } - throw exception; - } if (logger.isDebugEnabled()) { @@ -294,7 +274,7 @@ public class PublishUpdatesJobExecuter extends RecordsManagementJobExecuter return null; } }; - retryingTransactionHelper.doInTransaction(execution); + retryingTransactionHelper.doInTransaction(execution, false, true); } /** diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/jscript/app/JSONConversionComponent.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/jscript/app/JSONConversionComponent.java index 9816fda8ca..82b94f8fd0 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/jscript/app/JSONConversionComponent.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/jscript/app/JSONConversionComponent.java @@ -18,17 +18,12 @@ */ package org.alfresco.module.org_alfresco_module_rm.jscript.app; -import static org.alfresco.model.ContentModel.PROP_USERNAME; - import java.util.ArrayList; -import java.util.HashMap; import java.util.List; -import java.util.Map; -import java.util.Set; import org.alfresco.model.ContentModel; import org.alfresco.module.org_alfresco_module_rm.capability.CapabilityService; -import org.alfresco.module.org_alfresco_module_rm.capability.impl.ViewRecordsCapability; +import org.alfresco.module.org_alfresco_module_rm.capability.RMPermissionModel; import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanComponentKind; import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService; import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; @@ -44,8 +39,6 @@ import org.alfresco.service.cmr.model.FileInfo; import org.alfresco.service.cmr.repository.ChildAssociationRef; import org.alfresco.service.cmr.repository.NodeRef; import org.alfresco.service.cmr.security.AccessStatus; -import org.alfresco.service.cmr.security.AuthorityService; -import org.alfresco.service.cmr.security.AuthorityType; import org.alfresco.service.cmr.site.SiteInfo; import org.alfresco.service.cmr.site.SiteService; import org.alfresco.service.namespace.NamespaceService; @@ -60,24 +53,9 @@ import org.json.simple.JSONObject; * * @author Roy Wetherall */ -public class JSONConversionComponent extends org.alfresco.repo.jscript.app.JSONConversionComponent - implements NodeServicePolicies.OnDeleteNodePolicy, - NodeServicePolicies.OnCreateNodePolicy, - NodeServicePolicies.OnCreateChildAssociationPolicy, - NodeServicePolicies.OnDeleteChildAssociationPolicy +public class JSONConversionComponent extends org.alfresco.repo.jscript.app.JSONConversionComponent implements NodeServicePolicies.OnDeleteNodePolicy, + NodeServicePolicies.OnCreateNodePolicy { - /** JSON values */ - private static final String IS_RM_NODE = "isRmNode"; - private static final String RM_NODE = "rmNode"; - private static final String IS_RM_SITE_CREATED = "isRmSiteCreated"; - private static final String IS_RECORD_CONTRIBUTOR_GROUP_ENABLED = "isRecordContributorGroupEnabled"; - - /** true if record contributor group is enabled, false otherwise */ - private boolean isRecordContributorsGroupEnabled = false; - - /** record contributors group */ - private String recordContributorsGroupName = "RECORD_CONTRIBUTORS"; - /** Record service */ private RecordService recordService; @@ -93,9 +71,6 @@ public class JSONConversionComponent extends org.alfresco.repo.jscript.app.JS /** site service */ private SiteService siteService; - /** Authority service */ - private AuthorityService authorityService; - /** Indicators */ private List indicators = new ArrayList(); @@ -106,28 +81,10 @@ public class JSONConversionComponent extends org.alfresco.repo.jscript.app.JS private PolicyComponent policyComponent; /** JSON conversion component cache */ - private SimpleCache jsonConversionComponentCache; + private SimpleCache jsonConversionComponentCache; - /** Constants for checking the cache */ + /** Constant for checking the cache */ private static final String RM_SITE_EXISTS = "rmSiteExists"; - private static final String RM_RECORD_CONTRIBUTORS_GROUP_MEMBERS = "rmRecordContributorsGroupMembers"; - private static final String RM_SHOW_ACTIONS = "rmShowActions"; - - /** - * @param enabled true if enabled, false otherwise - */ - public void setRecordContributorsGroupEnabled(boolean enabled) - { - isRecordContributorsGroupEnabled = enabled; - } - - /** - * @param recordContributorsGroupName record contributors group name - */ - public void setRecordContributorsGroupName(String recordContributorsGroupName) - { - this.recordContributorsGroupName = recordContributorsGroupName; - } /** * @param recordService record service @@ -169,14 +126,6 @@ public class JSONConversionComponent extends org.alfresco.repo.jscript.app.JS this.siteService = siteService; } - /** - * @param authorityService authority service - */ - public void setAuthorityService(AuthorityService authorityService) - { - this.authorityService = authorityService; - } - /** * @param indicator registered indicator */ @@ -206,7 +155,7 @@ public class JSONConversionComponent extends org.alfresco.repo.jscript.app.JS * * @return The json conversion component cache */ - protected SimpleCache getJsonConversionComponentCache() + protected SimpleCache getJsonConversionComponentCache() { return this.jsonConversionComponentCache; } @@ -216,7 +165,7 @@ public class JSONConversionComponent extends org.alfresco.repo.jscript.app.JS * * @param jsonConversionComponentCache The json conversion component cache */ - public void setJsonConversionComponentCache(SimpleCache jsonConversionComponentCache) + public void setJsonConversionComponentCache(SimpleCache jsonConversionComponentCache) { this.jsonConversionComponentCache = jsonConversionComponentCache; } @@ -235,16 +184,6 @@ public class JSONConversionComponent extends org.alfresco.repo.jscript.app.JS QName.createQName(NamespaceService.ALFRESCO_URI, "onCreateNode"), RecordsManagementModel.TYPE_RM_SITE, new JavaBehaviour(this, "onCreateNode")); - - policyComponent.bindAssociationBehaviour( - QName.createQName(NamespaceService.ALFRESCO_URI, "onCreateChildAssociation"), - ContentModel.TYPE_AUTHORITY, - new JavaBehaviour(this, "onCreateChildAssociation")); - - policyComponent.bindAssociationBehaviour( - QName.createQName(NamespaceService.ALFRESCO_URI, "onDeleteChildAssociation"), - ContentModel.TYPE_AUTHORITY, - new JavaBehaviour(this, "onDeleteChildAssociation")); } /** @@ -260,28 +199,21 @@ public class JSONConversionComponent extends org.alfresco.repo.jscript.app.JS // Set the base root values super.setRootValues(nodeInfo, rootJSONObject, useShortQNames); - // check the exisitance of the RM site checkRmSiteExistence(rootJSONObject); - // get the record contributor information - rootJSONObject.put(IS_RECORD_CONTRIBUTOR_GROUP_ENABLED, isRecordContributorsGroupEnabled); - if (isRecordContributorsGroupEnabled) - { - rootJSONObject.put(RM_SHOW_ACTIONS, showRmActions()); - } - // Get the node reference for convenience NodeRef nodeRef = nodeInfo.getNodeRef(); - if (AccessStatus.ALLOWED.equals(capabilityService.getCapabilityAccessState(nodeRef, ViewRecordsCapability.NAME))) + if (AccessStatus.ALLOWED.equals(capabilityService.getCapabilityAccessState(nodeRef, + RMPermissionModel.VIEW_RECORDS))) { // Indicate whether the node is a RM object or not boolean isFilePlanComponent = filePlanService.isFilePlanComponent(nodeInfo.getNodeRef()); - rootJSONObject.put(IS_RM_NODE, isFilePlanComponent); + rootJSONObject.put("isRmNode", isFilePlanComponent); if (isFilePlanComponent) { - rootJSONObject.put(RM_NODE, setRmNodeValues(nodeRef, useShortQNames)); + rootJSONObject.put("rmNode", setRmNodeValues(nodeRef, useShortQNames)); // FIXME: Is this the right place to add the information? addInfo(nodeInfo, rootJSONObject); @@ -290,25 +222,6 @@ public class JSONConversionComponent extends org.alfresco.repo.jscript.app.JS } } - private boolean showRmActions() - { - if (!getJsonConversionComponentCache().contains(RM_RECORD_CONTRIBUTORS_GROUP_MEMBERS)) - { - Set groupMembers = authorityService.getContainedAuthorities(AuthorityType.USER, AuthorityType.GROUP.getPrefixString() + recordContributorsGroupName, false); - getJsonConversionComponentCache().put(RM_RECORD_CONTRIBUTORS_GROUP_MEMBERS, groupMembers); - } - - @SuppressWarnings("unchecked") - Set recordContributorsMembers = (Set) getJsonConversionComponentCache().get(RM_RECORD_CONTRIBUTORS_GROUP_MEMBERS); - - return recordContributorsMembers.contains(AuthenticationUtil.getFullyAuthenticatedUser()); - } - - /** - * Checks for the existance of the RM site - * - * @param rootJSONObject the root JSON object - */ @SuppressWarnings("unchecked") private void checkRmSiteExistence(JSONObject rootJSONObject) { @@ -318,17 +231,17 @@ public class JSONConversionComponent extends org.alfresco.repo.jscript.app.JS if (site != null) { getJsonConversionComponentCache().put(RM_SITE_EXISTS, true); - rootJSONObject.put(IS_RM_SITE_CREATED, true); + rootJSONObject.put("isRmSiteCreated", true); } else { getJsonConversionComponentCache().put(RM_SITE_EXISTS, false); - rootJSONObject.put(IS_RM_SITE_CREATED, false); + rootJSONObject.put("isRmSiteCreated", false); } } else { - rootJSONObject.put(IS_RM_SITE_CREATED, getJsonConversionComponentCache().get(RM_SITE_EXISTS)); + rootJSONObject.put("isRmSiteCreated", getJsonConversionComponentCache().get(RM_SITE_EXISTS)); } } @@ -380,7 +293,6 @@ public class JSONConversionComponent extends org.alfresco.repo.jscript.app.JS if (originatingLocation != null) { - // add the originating location (if there is one) String pathSeparator = "/"; String displayPath = getDisplayPath(originatingLocation); String[] displayPathElements = displayPath.split(pathSeparator); @@ -393,10 +305,10 @@ public class JSONConversionComponent extends org.alfresco.repo.jscript.app.JS rootJSONObject.put("originatingLocationPath", originatingLocationPath.toString()); } } - + /** * Helper method to get the display path. - * + * * @param nodeRef node reference * @return String display path */ @@ -412,14 +324,12 @@ public class JSONConversionComponent extends org.alfresco.repo.jscript.app.JS } /** - * Helper method to set the RM node values - * - * @param nodeRef node reference - * @param useShortQName indicates whether the short QName are used or not - * @return {@link JSONObject} JSON object containing values + * @param nodeRef + * @param useShortQName + * @return */ @SuppressWarnings("unchecked") - private JSONObject setRmNodeValues(final NodeRef nodeRef, final boolean useShortQName) + private JSONObject setRmNodeValues(NodeRef nodeRef, boolean useShortQName) { JSONObject rmNodeValues = new JSONObject(); @@ -430,39 +340,20 @@ public class JSONConversionComponent extends org.alfresco.repo.jscript.app.JS FilePlanComponentKind kind = filePlanService.getFilePlanComponentKind(nodeRef); rmNodeValues.put("kind", kind.toString()); - // set the primary parent node reference - ChildAssociationRef assoc = nodeService.getPrimaryParent(nodeRef); - if (assoc != null) + // File plan node reference + NodeRef filePlan = filePlanService.getFilePlan(nodeRef); + rmNodeValues.put("filePlan", filePlan.toString()); + + // Unfiled container node reference + NodeRef unfiledRecordContainer = filePlanService.getUnfiledContainer(filePlan); + if (unfiledRecordContainer != null) { - rmNodeValues.put("primaryParentNodeRef", assoc.getParentRef().toString()); + rmNodeValues.put("unfiledRecordContainer", unfiledRecordContainer.toString()); + rmNodeValues.put("properties", propertiesToJSON(unfiledRecordContainer, nodeService.getProperties(unfiledRecordContainer), useShortQName)); + QName type = fileFolderService.getFileInfo(unfiledRecordContainer).getType(); + rmNodeValues.put("type", useShortQName ? type.toPrefixString(namespaceService) : type.toString()); } - Map values = AuthenticationUtil.runAsSystem(new RunAsWork>() - { - public Map doWork() throws Exception - { - Map result = new HashMap(); - - // File plan node reference - NodeRef filePlan = filePlanService.getFilePlan(nodeRef); - result.put("filePlan", filePlan.toString()); - - // Unfiled container node reference - NodeRef unfiledRecordContainer = filePlanService.getUnfiledContainer(filePlan); - if (unfiledRecordContainer != null) - { - result.put("unfiledRecordContainer", unfiledRecordContainer.toString()); - result.put("properties", propertiesToJSON(unfiledRecordContainer, nodeService.getProperties(unfiledRecordContainer), useShortQName)); - QName type = fileFolderService.getFileInfo(unfiledRecordContainer).getType(); - result.put("type", useShortQName ? type.toPrefixString(namespaceService) : type.toString()); - } - - return result; - } - }); - - rmNodeValues.putAll(values); - // Set the indicators array setIndicators(rmNodeValues, nodeRef); @@ -622,38 +513,4 @@ public class JSONConversionComponent extends org.alfresco.repo.jscript.app.JS { getJsonConversionComponentCache().put(RM_SITE_EXISTS, true); } - - /** - * @see org.alfresco.repo.node.NodeServicePolicies.OnCreateChildAssociationPolicy#onCreateChildAssociation(org.alfresco.service.cmr.repository.ChildAssociationRef, boolean) - */ - @Override - public void onCreateChildAssociation(ChildAssociationRef childAssocRef, boolean isNewNode) - { - if (isRecordContributorsGroupEnabled) - { - if (!getJsonConversionComponentCache().contains(RM_RECORD_CONTRIBUTORS_GROUP_MEMBERS)) - { - Set groupMembers = authorityService.getContainedAuthorities(AuthorityType.USER, AuthorityType.GROUP.getPrefixString() + recordContributorsGroupName, false); - getJsonConversionComponentCache().put(RM_RECORD_CONTRIBUTORS_GROUP_MEMBERS, groupMembers); - } - - @SuppressWarnings("unchecked") - Set recordContributorsMembers = (Set) getJsonConversionComponentCache().get(RM_RECORD_CONTRIBUTORS_GROUP_MEMBERS); - recordContributorsMembers.add((String) nodeService.getProperty(childAssocRef.getChildRef(), PROP_USERNAME)); - } - } - - /** - * @see org.alfresco.repo.node.NodeServicePolicies.OnDeleteChildAssociationPolicy#onDeleteChildAssociation(org.alfresco.service.cmr.repository.ChildAssociationRef) - */ - @Override - public void onDeleteChildAssociation(ChildAssociationRef childAssocRef) - { - if (isRecordContributorsGroupEnabled && getJsonConversionComponentCache().contains(RM_RECORD_CONTRIBUTORS_GROUP_MEMBERS)) - { - @SuppressWarnings("unchecked") - Set groupMembers = (Set) getJsonConversionComponentCache().get(RM_RECORD_CONTRIBUTORS_GROUP_MEMBERS); - groupMembers.remove((String) nodeService.getProperty(childAssocRef.getChildRef(), PROP_USERNAME)); - } - } } diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/jscript/app/evaluator/MultiParentEvaluator.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/jscript/app/evaluator/MultiParentEvaluator.java index a3c3ca8d29..5eb1211921 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/jscript/app/evaluator/MultiParentEvaluator.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/jscript/app/evaluator/MultiParentEvaluator.java @@ -32,34 +32,27 @@ import org.alfresco.service.namespace.RegexQNamePattern; * Determines whether a node has multiple parents within a file plan * * @author Roy Wetherall - * @since 2.0 */ public class MultiParentEvaluator extends BaseEvaluator { - /** - * @see org.alfresco.module.org_alfresco_module_rm.jscript.app.BaseEvaluator#evaluateImpl(org.alfresco.service.cmr.repository.NodeRef) - */ @Override protected boolean evaluateImpl(final NodeRef nodeRef) { return AuthenticationUtil.runAsSystem(new RunAsWork() { + @Override public Boolean doWork() { - - // get parent associations List parents = nodeService.getParentAssocs(nodeRef, ContentModel.ASSOC_CONTAINS, RegexQNamePattern.MATCH_ALL); int count = 0; for (ChildAssociationRef parent : parents) { - // count file plan component parents if (nodeService.hasAspect(parent.getParentRef(), ASPECT_FILE_PLAN_COMPONENT)) { count++; } } - // return true if more than one return (count > 1); } }); diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/jscript/app/evaluator/TransferEvaluator.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/jscript/app/evaluator/TransferEvaluator.java index 56cb735b6a..06a89aa953 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/jscript/app/evaluator/TransferEvaluator.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/jscript/app/evaluator/TransferEvaluator.java @@ -22,13 +22,9 @@ import java.util.List; import org.alfresco.module.org_alfresco_module_rm.jscript.app.BaseEvaluator; import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; -import org.alfresco.repo.security.authentication.AuthenticationUtil; -import org.alfresco.repo.security.permissions.AccessDeniedException; import org.alfresco.service.cmr.repository.ChildAssociationRef; import org.alfresco.service.cmr.repository.NodeRef; import org.alfresco.service.namespace.RegexQNamePattern; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; /** * Evaluates whether the node in question is transferring is either a transfer or accession. @@ -37,9 +33,6 @@ import org.apache.commons.logging.LogFactory; */ public class TransferEvaluator extends BaseEvaluator { - /** Logger */ - private static Log logger = LogFactory.getLog(TransferEvaluator.class); - /** indicates whether we are looking for accessions or transfers */ private boolean transferAccessionIndicator = false; @@ -62,18 +55,8 @@ public class TransferEvaluator extends BaseEvaluator NodeRef transfer = getTransferNodeRef(nodeRef); if (transfer != null) { - try - { - boolean actual = ((Boolean)nodeService.getProperty(transfer, RecordsManagementModel.PROP_TRANSFER_ACCESSION_INDICATOR)).booleanValue(); - result = (actual == transferAccessionIndicator); - } - catch (AccessDeniedException ade) - { - logger.info("The user '" - + AuthenticationUtil.getFullyAuthenticatedUser() - + "' does not have permissions on the node '" - + transfer + "'."); - } + boolean actual = ((Boolean)nodeService.getProperty(transfer, RecordsManagementModel.PROP_TRANSFER_ACCESSION_INDICATOR)).booleanValue(); + result = (actual == transferAccessionIndicator); } return result; diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/model/RecordsManagementCustomModel.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/model/RecordsManagementCustomModel.java index 9a217e43c9..79853eb888 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/model/RecordsManagementCustomModel.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/model/RecordsManagementCustomModel.java @@ -49,8 +49,4 @@ public interface RecordsManagementCustomModel // Some Custom references which are present on system startup. QName CUSTOM_REF_VERSIONS = QName.createQName(RecordsManagementCustomModel.RM_CUSTOM_URI, "versions"); QName CUSTOM_REF_SUPERSEDES = QName.createQName(RecordsManagementCustomModel.RM_CUSTOM_URI, "supersedes"); - QName CUSTOM_REF_OBSOLETES = QName.createQName(RecordsManagementCustomModel.RM_CUSTOM_URI, "obsoletes"); - QName CUSTOM_REF_SUPPORTS = QName.createQName(RecordsManagementCustomModel.RM_CUSTOM_URI, "supports"); - QName CUSTOM_REF_CROSSREFERENCE = QName.createQName(RecordsManagementCustomModel.RM_CUSTOM_URI, "crossreference"); - QName CUSTOM_REF_RENDITION = QName.createQName(RecordsManagementCustomModel.RM_CUSTOM_URI, "rendition"); } diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/RecordAspect.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/RecordAspect.java index 8f8f8019c9..eef438f275 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/RecordAspect.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/aspect/RecordAspect.java @@ -25,6 +25,7 @@ import java.util.Set; import org.alfresco.model.ContentModel; import org.alfresco.module.org_alfresco_module_rm.RecordsManagementPolicies; +import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementCustomModel; 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.security.ExtendedSecurityService; @@ -68,7 +69,7 @@ public class RecordAspect extends AbstractDisposableItem /** script service */ protected ScriptService scriptService; - + /** record service */ protected RecordService recordService; @@ -87,7 +88,7 @@ public class RecordAspect extends AbstractDisposableItem { this.scriptService = scriptService; } - + /** * @param recordService record service */ @@ -149,7 +150,7 @@ public class RecordAspect extends AbstractDisposableItem public void onCreateReference(NodeRef fromNodeRef, NodeRef toNodeRef, QName reference) { // Deal with versioned records - if (reference.equals(CUSTOM_REF_VERSIONS)) + if (reference.equals(QName.createQName(RecordsManagementCustomModel.RM_CUSTOM_URI, "versions"))) { // Apply the versioned aspect to the from node nodeService.addAspect(fromNodeRef, ASPECT_VERSIONED_RECORD, null); @@ -168,22 +169,13 @@ public class RecordAspect extends AbstractDisposableItem kind = BehaviourKind.CLASS, notificationFrequency = NotificationFrequency.TRANSACTION_COMMIT ) - public void onRemoveReference(final NodeRef fromNodeRef, NodeRef toNodeRef, QName reference) + public void onRemoveReference(NodeRef fromNodeRef, NodeRef toNodeRef, QName reference) { // Deal with versioned records - if (reference.equals(CUSTOM_REF_VERSIONS)) + if (reference.equals(QName.createQName(RecordsManagementCustomModel.RM_CUSTOM_URI, "versions"))) { - AuthenticationUtil.runAsSystem(new RunAsWork() - { - @Override - public Void doWork() - { - // Apply the versioned aspect to the from node - nodeService.removeAspect(fromNodeRef, ASPECT_VERSIONED_RECORD); - - return null; - } - }); + // Apply the versioned aspect to the from node + nodeService.removeAspect(fromNodeRef, ASPECT_VERSIONED_RECORD); } // Execute script if for the reference event @@ -244,8 +236,7 @@ public class RecordAspect extends AbstractDisposableItem { public Object doWork() { - if (nodeService.exists(record) && - recordService.isFiled(record)) + if (nodeService.exists(record)) { // clean record cleanDisposableItem(nodeService, record); diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/type/CmObjectType.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/type/CmObjectType.java deleted file mode 100644 index bcafbfc2e8..0000000000 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/type/CmObjectType.java +++ /dev/null @@ -1,165 +0,0 @@ -/* - * Copyright (C) 2005-2015 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - */ -package org.alfresco.module.org_alfresco_module_rm.model.rma.type; - -import static org.alfresco.util.ParameterCheck.mandatory; - -import org.alfresco.error.AlfrescoRuntimeException; -import org.alfresco.model.ContentModel; -import org.alfresco.module.org_alfresco_module_rm.model.BaseBehaviourBean; -import org.alfresco.repo.copy.CopyServicePolicies; -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.alfresco.service.namespace.QName; - -/** - * cm:cmobject behaviour bean - * - * @author Tuna Aksoy - * @since 2.3 - */ -@BehaviourBean -( - defaultType = "cm:cmobject" -) -public class CmObjectType extends BaseBehaviourBean implements NodeServicePolicies.OnMoveNodePolicy, CopyServicePolicies.BeforeCopyPolicy -{ - /** Move behaviour name */ - private static final String MOVE_BEHAVIOUR_NAME = "onMoveCmObjectType"; - - /** Copy behaviour name */ - private static final String COPY_BEHAVIOUR_NAME = "onCopyCmObjectType"; - - /** - * Disable the move behaviour for this transaction - * - */ - public void disableMove() - { - getBehaviour(MOVE_BEHAVIOUR_NAME).disable(); - } - - /** - * Enable the move behaviour for this transaction - * - */ - public void enableMove() - { - getBehaviour(MOVE_BEHAVIOUR_NAME).enable(); - } - - /** - * Disable the copy behaviour for this transaction - * - */ - public void disableCopy() - { - getBehaviour(COPY_BEHAVIOUR_NAME).disable(); - } - - /** - * Enable the copy behaviour for this transaction - * - */ - public void enableCopy() - { - getBehaviour(COPY_BEHAVIOUR_NAME).enable(); - } - - /** - * @see org.alfresco.repo.node.NodeServicePolicies.OnMoveNodePolicy#onMoveNode(org.alfresco.service.cmr.repository.ChildAssociationRef, org.alfresco.service.cmr.repository.ChildAssociationRef) - */ - @Override - @Behaviour - ( - kind = BehaviourKind.CLASS, - name = MOVE_BEHAVIOUR_NAME - ) - public void onMoveNode(ChildAssociationRef oldChildAssocRef, ChildAssociationRef newChildAssocRef) - { - mandatory("oldChildAssocRef", oldChildAssocRef); - mandatory("newChildAssocRef", newChildAssocRef); - - NodeRef sourceParent = oldChildAssocRef.getParentRef(); - boolean isSourceParentFilePlanComponent = isFilePlanComponent(sourceParent); - - NodeRef targetParent = newChildAssocRef.getParentRef(); - boolean isTargetParentFilePlanComponent = isFilePlanComponent(targetParent); - - // If we are doing the move operation within the RM site then we can stop here - // The method should just check move operations from outside of RM into the RM site - if (isSourceParentFilePlanComponent && isTargetParentFilePlanComponent) - { - return; - } - - NodeRef object = oldChildAssocRef.getChildRef(); - QName objectType = nodeService.getType(object); - - // Only documents can be moved into the RM site - if (!objectType.equals(ContentModel.TYPE_CONTENT) && isTargetParentFilePlanComponent) - { - throw new AlfrescoRuntimeException("Only documents can be moved from a collaboration site into a RM site."); - } - - // Documents can be moved only into a RM folder - if (isTargetParentFilePlanComponent && !isRecordFolder(targetParent)) - { - throw new AlfrescoRuntimeException("A document can only be moved into a folder in RM site."); - } - } - - /** - * @see org.alfresco.repo.copy.CopyServicePolicies.BeforeCopyPolicy#beforeCopy(org.alfresco.service.namespace.QName, org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - @Behaviour - ( - kind = BehaviourKind.CLASS, - name = COPY_BEHAVIOUR_NAME - ) - public void beforeCopy(QName classRef, NodeRef sourceNodeRef, NodeRef targetNodeRef) - { - mandatory("sourceNodeRef", sourceNodeRef); - mandatory("targetNodeRef", targetNodeRef); - - NodeRef sourceParentNodeRef = nodeService.getPrimaryParent(sourceNodeRef).getParentRef(); - boolean isSourceParentFilePlanComponent = isFilePlanComponent(sourceParentNodeRef); - - NodeRef targetParentNodeRef = nodeService.getPrimaryParent(targetNodeRef).getParentRef(); - boolean isTargetNodeParentFilePlanComponent = isFilePlanComponent(targetParentNodeRef); - - // If we are doing the copy operation within the RM site then we can stop here - // The method should just check copy operations from outside of RM into the RM site - if (isSourceParentFilePlanComponent && isTargetNodeParentFilePlanComponent) - { - return; - } - - // Do not allow to copy anything outside of RM site into the RM site - if (!isSourceParentFilePlanComponent && isTargetNodeParentFilePlanComponent) - { - throw new AlfrescoRuntimeException("Nothing can be copied from a collaboration site into a RM site."); - } - } -} diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/type/RecordsManagementContainerType.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/type/RecordsManagementContainerType.java index 38214b000d..c68d2bcf93 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/type/RecordsManagementContainerType.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/model/rma/type/RecordsManagementContainerType.java @@ -48,9 +48,6 @@ import org.alfresco.service.namespace.QName; public class RecordsManagementContainerType extends BaseBehaviourBean implements NodeServicePolicies.OnCreateChildAssociationPolicy { - /** behaviour name */ - private static final String BEHAVIOUR_NAME = "onCreateContainerType"; - /** identifier service */ protected IdentifierService identifierService; @@ -83,26 +80,6 @@ public class RecordsManagementContainerType extends BaseBehaviourBean { this.recordFolderService = recordFolderService; } - - /** - * Disable the behaviours for this transaction - * - * @since 2.3 - */ - public void disable() - { - getBehaviour(BEHAVIOUR_NAME).disable(); - } - - /** - * Enable behaviours for this transaction - * - * @since 2.3 - */ - public void enable() - { - getBehaviour(BEHAVIOUR_NAME).enable(); - } /** * @see org.alfresco.module.org_alfresco_module_rm.model.BaseTypeBehaviour#onCreateChildAssociation(org.alfresco.service.cmr.repository.ChildAssociationRef, boolean) @@ -110,8 +87,7 @@ public class RecordsManagementContainerType extends BaseBehaviourBean @Behaviour ( kind = BehaviourKind.ASSOCIATION, - notificationFrequency = NotificationFrequency.TRANSACTION_COMMIT, - name = BEHAVIOUR_NAME + notificationFrequency = NotificationFrequency.TRANSACTION_COMMIT ) public void onCreateChildAssociation(final ChildAssociationRef childAssocRef, boolean isNewNode) { @@ -189,9 +165,8 @@ public class RecordsManagementContainerType extends BaseBehaviourBean } /** - * Set the identifier property * - * @param nodeRef node reference + * @param nodeRef */ protected void setIdenifierProperty(final NodeRef nodeRef) { diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v21/RMv21BehaviorScriptsPatch.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v21/RMv21BehaviorScriptsPatch.java index a66a16aa5f..dd6748d44f 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v21/RMv21BehaviorScriptsPatch.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v21/RMv21BehaviorScriptsPatch.java @@ -18,8 +18,6 @@ */ package org.alfresco.module.org_alfresco_module_rm.patch.v21; -import static org.apache.commons.logging.LogFactory.getLog; - import java.io.Serializable; import java.util.HashMap; import java.util.List; @@ -36,7 +34,6 @@ import org.alfresco.service.cmr.repository.NodeService; import org.alfresco.service.cmr.repository.StoreRef; import org.alfresco.service.namespace.NamespaceService; import org.alfresco.service.namespace.QName; -import org.apache.commons.logging.Log; import org.springframework.beans.factory.BeanNameAware; /** @@ -47,11 +44,9 @@ import org.springframework.beans.factory.BeanNameAware; * @author Craig Tan * @since 2.1 */ +@SuppressWarnings("deprecation") public class RMv21BehaviorScriptsPatch extends RMv21PatchComponent implements BeanNameAware { - /** Logger */ - private static final Log LOGGER = getLog(RMv21BehaviorScriptsPatch.class); - /** rm config folder root lookup */ protected static final NodeRef RM_CONFIG = new NodeRef(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, "rm_config_folder"); @@ -59,7 +54,7 @@ public class RMv21BehaviorScriptsPatch extends RMv21PatchComponent implements Be protected static final NodeRef OLD_BEHAVIOR_SCRIPTS_FOLDER = new NodeRef(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, "rm_scripts"); /** new behavior scripts folder root lookup */ - private static NodeRef newBehaviorScriptsFolder = new NodeRef(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, "rm_behavior_scripts"); + protected static NodeRef newBehaviorScriptsFolder = new NodeRef(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, "rm_behavior_scripts"); /** name of example script */ protected static final String IS_CLOSED_JS = "rma_isClosed.js"; @@ -128,7 +123,6 @@ public class RMv21BehaviorScriptsPatch extends RMv21PatchComponent implements Be // run the following code as System AuthenticationUtil.runAs(new RunAsWork() { - @SuppressWarnings("deprecation") public Object doWork() { RetryingTransactionCallback callback = new RetryingTransactionCallback() diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v22/RMv22CapabilityPatch.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v22/RMv22CapabilityPatch.java index 824a06098e..1226edf1ee 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v22/RMv22CapabilityPatch.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v22/RMv22CapabilityPatch.java @@ -35,7 +35,7 @@ public class RMv22CapabilityPatch extends CapabilityPatch */ protected void applyCapabilityPatch(NodeRef filePlan) { - // add new capability + // add new capbilities addCapability(filePlan, "FileDestructionReport", FilePlanRoleService.ROLE_ADMIN, @@ -52,5 +52,11 @@ public class RMv22CapabilityPatch extends CapabilityPatch "RemoveFromHold", FilePlanRoleService.ROLE_ADMIN, FilePlanRoleService.ROLE_RECORDS_MANAGER); + + // @see https://issues.alfresco.com/jira/browse/RM-2058 + addCapability(filePlan, + "ManageAccessControls", + FilePlanRoleService.ROLE_SECURITY_OFFICER, + FilePlanRoleService.ROLE_RECORDS_MANAGER); } } diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v22/RMv22HoldCapabilityPatch.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v22/RMv22HoldCapabilityPatch.java index c0582e0f26..a3967cc1c5 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v22/RMv22HoldCapabilityPatch.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v22/RMv22HoldCapabilityPatch.java @@ -23,7 +23,7 @@ import org.alfresco.module.org_alfresco_module_rm.role.FilePlanRoleService; import org.alfresco.service.cmr.repository.NodeRef; /** - * RM v2.2 patch to add new hold releated capabilities. + * RM v2.2 patch to update capabilities. * * @author Roy Wetherall * @since 2.2 diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v23/RMv23EndRetentionCapabilityPatch.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v23/RMv23EndRetentionCapabilityPatch.java deleted file mode 100644 index 9fe8ee707b..0000000000 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v23/RMv23EndRetentionCapabilityPatch.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright (C) 2005-2014 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - */ -package org.alfresco.module.org_alfresco_module_rm.patch.v23; - -import org.alfresco.module.org_alfresco_module_rm.patch.common.CapabilityPatch; -import org.alfresco.module.org_alfresco_module_rm.role.FilePlanRoleService; -import org.alfresco.service.cmr.repository.NodeRef; - -/** - * RM v2.3 patch to add new end retention capability. - * - * @author Alex Balan - * @since 2.3 - */ -public class RMv23EndRetentionCapabilityPatch extends CapabilityPatch -{ - /** - * @see org.alfresco.module.org_alfresco_module_rm.patch.common.CapabilityPatch#applyCapabilityPatch(org.alfresco.service.cmr.repository.NodeRef) - */ - protected void applyCapabilityPatch(NodeRef filePlan) - { - // add new capability - addCapability(filePlan, - "EndRetention", - FilePlanRoleService.ROLE_ADMIN, - FilePlanRoleService.ROLE_RECORDS_MANAGER); - - } -} diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v23/RMv23RecordContributorsGroupPatch.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v23/RMv23RecordContributorsGroupPatch.java deleted file mode 100644 index ab9d387b53..0000000000 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v23/RMv23RecordContributorsGroupPatch.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (C) 2005-2014 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - */ -package org.alfresco.module.org_alfresco_module_rm.patch.v23; - -import org.alfresco.module.org_alfresco_module_rm.bootstrap.RecordContributorsGroupBootstrapComponent; -import org.alfresco.module.org_alfresco_module_rm.patch.AbstractModulePatch; - -/** - * RM v2.3 patch that creates the record contributors group. - * - * @author Roy Wetherall - * @since 2.3 - */ -public class RMv23RecordContributorsGroupPatch extends AbstractModulePatch -{ - /** record contributors group bootstrap component */ - private RecordContributorsGroupBootstrapComponent recordContributorsGroupBootstrapComponent; - - /** - * @param recordContributorsGroupBootstrapComponent record contributors group bootstrap component - */ - public void setRecordContributorsGroupBootstrapComponent(RecordContributorsGroupBootstrapComponent recordContributorsGroupBootstrapComponent) - { - this.recordContributorsGroupBootstrapComponent = recordContributorsGroupBootstrapComponent; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.patch.AbstractModulePatch#applyInternal() - */ - @Override - public void applyInternal() - { - // create record contributors group - recordContributorsGroupBootstrapComponent.createRecordContributorsGroup(); - } - -} diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v23/RMv23VersionsEventPatch.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v23/RMv23VersionsEventPatch.java deleted file mode 100644 index 696183e5ac..0000000000 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/patch/v23/RMv23VersionsEventPatch.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright (C) 2005-2014 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - */ -package org.alfresco.module.org_alfresco_module_rm.patch.v23; - -import org.alfresco.module.org_alfresco_module_rm.event.RecordsManagementEventService; -import org.alfresco.module.org_alfresco_module_rm.patch.AbstractModulePatch; -import org.springframework.extensions.surf.util.I18NUtil; - -/** - * RM v2.3 patch that creates the versions event. - * - * @author Roy Wetherall - * @since 2.3 - */ -public class RMv23VersionsEventPatch extends AbstractModulePatch -{ - /** event details */ - private static final String EVENT_TYPE = "rmEventType.versioned"; - private static final String EVENT_NAME = "versioned"; - private static final String EVENT_I18N = "rmevent.versioned"; - - /** records management event service */ - private RecordsManagementEventService recordsManagementEventService; - - /** - * @param recordsManagementEventService records management event service - */ - public void setRecordsManagementEventService(RecordsManagementEventService recordsManagementEventService) - { - this.recordsManagementEventService = recordsManagementEventService; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.patch.AbstractModulePatch#applyInternal() - */ - @Override - public void applyInternal() - { - // add versions event - recordsManagementEventService.addEvent(EVENT_TYPE, EVENT_NAME, I18NUtil.getMessage(EVENT_I18N)); - } - -} diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/record/InplaceRecordService.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/record/InplaceRecordService.java deleted file mode 100644 index a3c27c465e..0000000000 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/record/InplaceRecordService.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright (C) 2005-2014 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - */ -package org.alfresco.module.org_alfresco_module_rm.record; - -import org.alfresco.service.cmr.repository.NodeRef; - -/** - * Inplace Record Service Interface. - * - * @author Tuna Aksoy - * @since 2.3 - */ -public interface InplaceRecordService -{ - /** - * Hides a record within a collaboration site - * - * @param nodeRef The record which should be hidden - */ - void hideRecord(NodeRef nodeRef); - - /** - * Moves a record within a collaboration site - * - * @param nodeRef The record which should be moved - * @param targetNodeRef The target node reference where it should be moved to - */ - void moveRecord(NodeRef nodeRef, NodeRef targetNodeRef); -} diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/record/InplaceRecordServiceImpl.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/record/InplaceRecordServiceImpl.java deleted file mode 100644 index 16bd7effb9..0000000000 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/record/InplaceRecordServiceImpl.java +++ /dev/null @@ -1,189 +0,0 @@ -/* - * Copyright (C) 2005-2014 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - */ -package org.alfresco.module.org_alfresco_module_rm.record; - -import static org.alfresco.model.ContentModel.ASPECT_PENDING_DELETE; - -import java.util.List; -import java.util.Set; - -import org.alfresco.error.AlfrescoRuntimeException; -import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; -import org.alfresco.module.org_alfresco_module_rm.security.ExtendedSecurityService; -import org.alfresco.module.org_alfresco_module_rm.util.ServiceBaseImpl; -import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork; -import org.alfresco.service.cmr.model.FileExistsException; -import org.alfresco.service.cmr.model.FileFolderService; -import org.alfresco.service.cmr.model.FileNotFoundException; -import org.alfresco.service.cmr.repository.ChildAssociationRef; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.site.SiteInfo; -import org.alfresco.service.cmr.site.SiteService; -import org.alfresco.util.ParameterCheck; - -/** - * Inplace record service implementation. - * - * @author Tuna Aksoy - * @since 2.3 - */ -public class InplaceRecordServiceImpl extends ServiceBaseImpl implements InplaceRecordService, RecordsManagementModel -{ - /** Site service */ - private SiteService siteService; - - /** Extended security service */ - private ExtendedSecurityService extendedSecurityService; - - /** File folder service */ - private FileFolderService fileFolderService; - - /** - * @param siteService site service - */ - public void setSiteService(SiteService siteService) - { - this.siteService = siteService; - } - - /** - * @param extendedSecurityService extended security service - */ - public void setExtendedSecurityService( - ExtendedSecurityService extendedSecurityService) - { - this.extendedSecurityService = extendedSecurityService; - } - - /** - * @param fileFolderService file folder service - */ - public void setFileFolderService(FileFolderService fileFolderService) - { - this.fileFolderService = fileFolderService; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.record.InplaceRecordService#hideRecord(org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - public void hideRecord(final NodeRef nodeRef) - { - ParameterCheck.mandatory("NodeRef", nodeRef); - - // do the work of hiding the record as the system user - authenticationUtil.runAsSystem(new RunAsWork() - { - @Override - public Void doWork() - { - // remove the child association - NodeRef originatingLocation = (NodeRef) nodeService.getProperty(nodeRef, PROP_RECORD_ORIGINATING_LOCATION); - List parentAssocs = nodeService.getParentAssocs(nodeRef); - for (ChildAssociationRef childAssociationRef : parentAssocs) - { - if (!childAssociationRef.isPrimary() && - childAssociationRef.getParentRef().equals(originatingLocation) && - !nodeService.hasAspect(childAssociationRef.getChildRef(), ASPECT_PENDING_DELETE)) - { - nodeService.removeChildAssociation(childAssociationRef); - break; - } - } - - // remove the extended security from the node - // this prevents the users from continuing to see the record in searchs and other linked locations - extendedSecurityService.removeAllExtendedSecurity(nodeRef); - - return null; - } - }); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.record.InplaceRecordService#moveRecord(org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - public void moveRecord(final NodeRef nodeRef, final NodeRef targetNodeRef) - { - ParameterCheck.mandatory("nodeRef", nodeRef); - ParameterCheck.mandatory("targetNodeRef", targetNodeRef); - - NodeRef sourceParentNodeRef = null; - - NodeRef originatingLocation = (NodeRef) nodeService.getProperty(nodeRef, PROP_RECORD_ORIGINATING_LOCATION); - for (ChildAssociationRef parentAssoc : nodeService.getParentAssocs(nodeRef)) - { - if (!parentAssoc.isPrimary() && parentAssoc.getParentRef().equals(originatingLocation)) - { - sourceParentNodeRef = parentAssoc.getParentRef(); - break; - } - } - - if (sourceParentNodeRef == null) - { - throw new AlfrescoRuntimeException("Could not find source parent node reference."); - } - - SiteInfo sourceSite = siteService.getSite(sourceParentNodeRef); - SiteInfo targetSite = siteService.getSite(targetNodeRef); - - if (!sourceSite.equals(targetSite)) - { - throw new AlfrescoRuntimeException("The record can only be moved within the same collaboration site."); - } - - if (!sourceSite.getSitePreset().equals("site-dashboard")) - { - throw new AlfrescoRuntimeException("Only records within a collaboration site can be moved."); - } - - final NodeRef source = sourceParentNodeRef; - - authenticationUtil.runAsSystem(new RunAsWork() - { - @Override - public Void doWork() - { - try - { - // Get the extended readers/writers - Set extendedReaders = extendedSecurityService.getExtendedReaders(nodeRef); - Set extendedWriters = extendedSecurityService.getExtendedWriters(nodeRef); - - // Move the record - fileFolderService.moveFrom(nodeRef, source, targetNodeRef, null); - - // Update the originating location property - nodeService.setProperty(nodeRef, PROP_RECORD_ORIGINATING_LOCATION, targetNodeRef); - - // Set the extended readers/writers - extendedSecurityService.addExtendedSecurity(nodeRef, extendedReaders, extendedWriters); - } - catch (FileExistsException | FileNotFoundException ex) - { - throw new AlfrescoRuntimeException("Can't move node: " + ex); - } - - return null; - } - }); - } -} diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/record/RecordLinkRuntimeException.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/record/RecordLinkRuntimeException.java deleted file mode 100644 index b114543715..0000000000 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/record/RecordLinkRuntimeException.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (C) 2005-2014 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - */ -package org.alfresco.module.org_alfresco_module_rm.record; - -import org.alfresco.error.AlfrescoRuntimeException; - - -/** - * Record link exception class - * - * @author Roy Wetherall - * @since 2.3 - */ -public class RecordLinkRuntimeException extends AlfrescoRuntimeException -{ - private static final long serialVersionUID = 5202539484220535897L; - - public RecordLinkRuntimeException(String msgId, Throwable cause) - { - super(msgId, cause); - } - - public RecordLinkRuntimeException(String msgId, Object[] msgParams, Throwable cause) - { - super(msgId, msgParams, cause); - } - - public RecordLinkRuntimeException(String msgId, Object[] msgParams) - { - super(msgId, msgParams); - } - - public RecordLinkRuntimeException(String msgId) - { - super(msgId); - } -} diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/record/RecordService.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/record/RecordService.java index 9b33b71687..92a17e9b86 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/record/RecordService.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/record/RecordService.java @@ -54,16 +54,13 @@ public interface RecordService /** * Disables the property editable check. - * - * @since 2.2 */ void disablePropertyEditableCheck(); - + /** * Disables the property editable check for a given node in this transaction only. - * - * @param nodeRef node reference * + * @param nodeRef node reference * @since 2.2 */ void disablePropertyEditableCheck(NodeRef nodeRef); @@ -82,29 +79,6 @@ public interface RecordService */ @Deprecated Set getRecordMetaDataAspects(); - - /** - * Indicates whether the provided aspect is a registered record meta-data - * aspect. - * - * @param aspect aspect {@link QName} - * @return boolean true if the aspect is a registered record meta-data aspect, false otherwise - * - * @since 2.3 - */ - boolean isRecordMetadataAspect(QName aspect); - - /** - * Indicates whther the provided property is declared on a registered record - * meta-data aspect. - * - * @param property property {@link QName} - * @return boolean true if the property is declared on a registered record meta-data aspect, - * false otherwise - * - * @since 2.3 - */ - boolean isRecordMetadataProperty(QName property); /** * Gets a list of all the record metadata aspects relevant to the file plan type of the @@ -167,14 +141,6 @@ public interface RecordService * @see #createRecord(NodeRef, NodeRef, boolean) */ void createRecord(NodeRef filePlan, NodeRef nodeRef); - - /** - * Creates a record from a copy of the node reference provided. - * - * @param filePlan file plan - * @param nodeRef node reference - */ - NodeRef createRecordFromCopy(NodeRef filePlan, NodeRef nodeRef); /** * Creates a new document in the unfiled records container if the given node reference is a file plan @@ -203,6 +169,13 @@ public interface RecordService */ void file(NodeRef record); + /** + * Hides a record within a collaboration site + * + * @param nodeRef The record which should be hidden + */ + void hideRecord(NodeRef nodeRef); + /** * Rejects a record with the provided reason * @@ -252,20 +225,10 @@ public interface RecordService void makeRecord(NodeRef nodeRef); /** - * Links a record to a record folder + * Creates a link for the specified document in target * - * @param record the record to link - * @param recordFolder the record folder to link it to + * @param nodeRef The document node reference for which a link will be created + * @param folder The folder in which the link will be created */ - void link(NodeRef record, NodeRef recordFolder); - - /** - * Unlinks a record from a specified record folder. - * - * @param record the record to unlink - * @param recordFolder the record folder to unlink it from - * - * @since 2.3 - */ - void unlink(NodeRef record, NodeRef recordFolder); + void link(NodeRef nodeRef, NodeRef folder); } diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/record/RecordServiceImpl.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/record/RecordServiceImpl.java index 0432c1c086..0cc4cd45f2 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/record/RecordServiceImpl.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/record/RecordServiceImpl.java @@ -18,13 +18,8 @@ */ package org.alfresco.module.org_alfresco_module_rm.record; -import static org.alfresco.module.org_alfresco_module_rm.version.RecordableVersionModel.PROP_VERSIONED_NODEREF; -import static org.alfresco.module.org_alfresco_module_rm.version.RecordableVersionModel.PROP_VERSION_LABEL; -import static org.apache.commons.lang.StringUtils.isNotBlank; - import java.io.Serializable; import java.util.ArrayList; -import java.util.Arrays; import java.util.Calendar; import java.util.Collection; import java.util.Collections; @@ -43,25 +38,18 @@ import org.alfresco.module.org_alfresco_module_rm.RecordsManagementPolicies.OnFi import org.alfresco.module.org_alfresco_module_rm.capability.Capability; import org.alfresco.module.org_alfresco_module_rm.capability.CapabilityService; import org.alfresco.module.org_alfresco_module_rm.capability.RMPermissionModel; -import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionSchedule; -import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionService; import org.alfresco.module.org_alfresco_module_rm.dod5015.DOD5015Model; import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService; import org.alfresco.module.org_alfresco_module_rm.identifier.IdentifierService; import org.alfresco.module.org_alfresco_module_rm.model.BaseBehaviourBean; import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementCustomModel; import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; -import org.alfresco.module.org_alfresco_module_rm.model.rma.type.RecordsManagementContainerType; import org.alfresco.module.org_alfresco_module_rm.model.security.ModelAccessDeniedException; import org.alfresco.module.org_alfresco_module_rm.notification.RecordsManagementNotificationHelper; import org.alfresco.module.org_alfresco_module_rm.recordfolder.RecordFolderService; -import org.alfresco.module.org_alfresco_module_rm.relationship.RelationshipService; -import org.alfresco.module.org_alfresco_module_rm.report.ReportModel; import org.alfresco.module.org_alfresco_module_rm.role.FilePlanRoleService; import org.alfresco.module.org_alfresco_module_rm.role.Role; import org.alfresco.module.org_alfresco_module_rm.security.ExtendedSecurityService; -import org.alfresco.module.org_alfresco_module_rm.version.RecordableVersionModel; -import org.alfresco.module.org_alfresco_module_rm.version.RecordableVersionServiceImpl; import org.alfresco.repo.node.NodeServicePolicies; import org.alfresco.repo.policy.Behaviour.NotificationFrequency; import org.alfresco.repo.policy.ClassPolicyDelegate; @@ -74,14 +62,13 @@ import org.alfresco.repo.security.authentication.AuthenticationUtil; import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork; import org.alfresco.repo.security.permissions.AccessDeniedException; import org.alfresco.repo.security.permissions.impl.ExtendedPermissionService; +import org.alfresco.repo.transaction.TransactionalResourceHelper; import org.alfresco.service.cmr.dictionary.AspectDefinition; import org.alfresco.service.cmr.dictionary.ClassDefinition; import org.alfresco.service.cmr.dictionary.PropertyDefinition; import org.alfresco.service.cmr.model.FileExistsException; import org.alfresco.service.cmr.model.FileFolderService; -import org.alfresco.service.cmr.model.FileInfo; import org.alfresco.service.cmr.model.FileNotFoundException; -import org.alfresco.service.cmr.repository.AssociationRef; import org.alfresco.service.cmr.repository.ChildAssociationRef; import org.alfresco.service.cmr.repository.ContentData; import org.alfresco.service.cmr.repository.ContentReader; @@ -93,15 +80,11 @@ import org.alfresco.service.cmr.security.AccessPermission; import org.alfresco.service.cmr.security.AccessStatus; import org.alfresco.service.cmr.security.OwnableService; import org.alfresco.service.cmr.security.PermissionService; -import org.alfresco.service.cmr.version.Version; -import org.alfresco.service.cmr.version.VersionHistory; -import org.alfresco.service.cmr.version.VersionService; import org.alfresco.service.namespace.NamespaceService; import org.alfresco.service.namespace.QName; import org.alfresco.service.namespace.RegexQNamePattern; import org.alfresco.util.EqualsHelper; import org.alfresco.util.ParameterCheck; -import org.alfresco.util.PropertyMap; import org.apache.commons.lang.ArrayUtils; import org.apache.commons.lang.StringUtils; import org.apache.commons.logging.Log; @@ -122,21 +105,16 @@ public class RecordServiceImpl extends BaseBehaviourBean NodeServicePolicies.OnCreateChildAssociationPolicy, NodeServicePolicies.OnAddAspectPolicy, NodeServicePolicies.OnRemoveAspectPolicy, - NodeServicePolicies.OnUpdatePropertiesPolicy, - NodeServicePolicies.BeforeDeleteNodePolicy + NodeServicePolicies.OnUpdatePropertiesPolicy { /** Logger */ private static Log logger = LogFactory.getLog(RecordServiceImpl.class); /** transation data key */ - private static final String KEY_IGNORE_ON_UPDATE = "ignoreOnUpdate"; - private static final String KEY_PENDING_FILLING = "pendingFilling"; - public static final String KEY_NEW_RECORDS = "newRecords"; + private static final String IGNORE_ON_UPDATE = "ignoreOnUpdate"; /** I18N */ private static final String MSG_NODE_HAS_ASPECT = "rm.service.node-has-aspect"; - private static final String FINAL_VERSION = "rm.service.final-version"; - private static final String FINAL_DESCRIPTION = "rm.service.final-version-description"; /** Always edit property array */ private static final QName[] ALWAYS_EDIT_PROPERTIES = new QName[] @@ -158,14 +136,12 @@ public class RecordServiceImpl extends BaseBehaviourBean }; /** record model URI's */ - public static final List RECORD_MODEL_URIS = Collections.unmodifiableList( - Arrays.asList( - RM_URI, - RM_CUSTOM_URI, - ReportModel.RMR_URI, - RecordableVersionModel.RMV_URI, - DOD5015Model.DOD_URI - )); + private static final String[] RECORD_MODEL_URIS = new String[] + { + RM_URI, + RM_CUSTOM_URI, + DOD5015Model.DOD_URI + }; /** non-record model URI's */ private static final String[] NON_RECORD_MODEL_URIS = new String[] @@ -218,18 +194,6 @@ public class RecordServiceImpl extends BaseBehaviourBean /** Permission service */ private PermissionService permissionService; - /** Version service */ - private VersionService versionService; - - /** Relationship service */ - private RelationshipService relationshipService; - - /** Disposition service */ - private DispositionService dispositionService; - - /** records management container type */ - private RecordsManagementContainerType recordsManagementContainerType; - /** list of available record meta-data aspects and the file plan types the are applicable to */ private Map> recordMetaDataAspects; @@ -351,38 +315,6 @@ public class RecordServiceImpl extends BaseBehaviourBean this.permissionService = permissionService; } - /** - * @param versionService version service - */ - public void setVersionService(VersionService versionService) - { - this.versionService = versionService; - } - - /** - * @param relationshipService relationship service - */ - public void setRelationshipService(RelationshipService relationshipService) - { - this.relationshipService = relationshipService; - } - - /** - * @param dispositionService disposition service - */ - public void setDispositionService(DispositionService dispositionService) - { - this.dispositionService = dispositionService; - } - - /** - * @param recordsManagementContainerType records management container type - */ - public void setRecordsManagementContainerType(RecordsManagementContainerType recordsManagementContainerType) - { - this.recordsManagementContainerType = recordsManagementContainerType; - } - /** * Init method */ @@ -430,7 +362,7 @@ public class RecordServiceImpl extends BaseBehaviourBean else { // check whether filling is pending aspect removal - Set pendingFilling = transactionalResourceHelper.getSet(KEY_PENDING_FILLING); + Set pendingFilling = TransactionalResourceHelper.getSet("pendingFilling"); if (pendingFilling.contains(nodeRef)) { file(nodeRef); @@ -521,46 +453,22 @@ public class RecordServiceImpl extends BaseBehaviourBean if (nodeService.hasAspect(nodeRef, ContentModel.ASPECT_NO_CONTENT)) { // we need to postpone filling until the NO_CONTENT aspect is removed - Set pendingFilling = transactionalResourceHelper.getSet(KEY_PENDING_FILLING); + Set pendingFilling = TransactionalResourceHelper.getSet("pendingFilling"); pendingFilling.add(nodeRef); } else { - // store information about the 'new' record in the transaction - // @since 2.3 - // @see https://issues.alfresco.com/jira/browse/RM-1956 - if (bNew) - { - Set newRecords = transactionalResourceHelper.getSet(KEY_NEW_RECORDS); - newRecords.add(nodeRef); - } - else - { - // if we are linking a record - NodeRef parentNodeRef = childAssocRef.getParentRef(); - if (isRecord(nodeRef) && isRecordFolder(parentNodeRef)) - { - // validate the link conditions - validateLinkConditions(nodeRef, parentNodeRef); - } - } - // create and file the content as a record file(nodeRef); } } } - catch (RecordLinkRuntimeException e) - { - // rethrow exception - throw e; - } catch (AlfrescoRuntimeException e) { // do nothing but log error - if (logger.isWarnEnabled()) + if (logger.isDebugEnabled()) { - logger.warn("Unable to file pending record.", e); + logger.debug("Unable to file pending record.", e); } } finally @@ -608,7 +516,7 @@ public class RecordServiceImpl extends BaseBehaviourBean */ public void disablePropertyEditableCheck(NodeRef nodeRef) { - Set ignoreOnUpdate = transactionalResourceHelper.getSet(KEY_IGNORE_ON_UPDATE); + Set ignoreOnUpdate = TransactionalResourceHelper.getSet(IGNORE_ON_UPDATE); ignoreOnUpdate.add(nodeRef); } @@ -639,7 +547,7 @@ public class RecordServiceImpl extends BaseBehaviourBean !AuthenticationUtil.isRunAsUserTheSystemUser() && nodeService.exists(nodeRef) && isRecord(nodeRef) && - !transactionalResourceHelper.getSet(KEY_IGNORE_ON_UPDATE).contains(nodeRef)) + !TransactionalResourceHelper.getSet(IGNORE_ON_UPDATE).contains(nodeRef)) { for (Map.Entry entry : after.entrySet()) { @@ -666,7 +574,7 @@ public class RecordServiceImpl extends BaseBehaviourBean afterCal.set(Calendar.MILLISECOND, 0); propertyUnchanged = (beforeCal.compareTo(afterCal) == 0); } - else if ((afterValue instanceof Boolean) && (beforeValue == null) && (afterValue.equals(Boolean.FALSE))) + else if ((afterValue instanceof Boolean) && (beforeValue == null) && (afterValue == Boolean.FALSE)) { propertyUnchanged = true; } @@ -774,35 +682,6 @@ public class RecordServiceImpl extends BaseBehaviourBean return getRecordMetadataAspects(TYPE_FILE_PLAN); } - /** - * @see org.alfresco.module.org_alfresco_module_rm.record.RecordService#isRecordMetadataAspect(org.alfresco.service.namespace.QName) - */ - @Override - public boolean isRecordMetadataAspect(QName aspect) - { - return getRecordMetadataAspectsMap().containsKey(aspect); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.record.RecordService#isRecordMetadataProperty(org.alfresco.service.namespace.QName) - */ - @Override - public boolean isRecordMetadataProperty(QName property) - { - boolean result = false; - PropertyDefinition propertyDefinition = dictionaryService.getProperty(property); - if (propertyDefinition != null) - { - ClassDefinition classDefinition = propertyDefinition.getContainerClass(); - if (classDefinition != null && - getRecordMetadataAspectsMap().containsKey(classDefinition.getName())) - { - result = true; - } - } - return result; - } - /** * @see org.alfresco.module.org_alfresco_module_rm.record.RecordService#getRecordMetaDataAspects(org.alfresco.service.cmr.repository.NodeRef) */ @@ -895,12 +774,12 @@ public class RecordServiceImpl extends BaseBehaviourBean // add the current owner to the list of extended writers String owner = ownableService.getOwner(nodeRef); + // remove the owner + ownableService.setOwner(nodeRef, OwnableService.NO_OWNER); + // get the documents primary parent assoc ChildAssociationRef parentAssoc = nodeService.getPrimaryParent(nodeRef); - // get the latest version record, if there is one - NodeRef latestVersionRecord = getLatestVersionRecord(nodeRef); - behaviourFilter.disableBehaviour(); try { @@ -922,18 +801,6 @@ public class RecordServiceImpl extends BaseBehaviourBean // make the document a record makeRecord(nodeRef); - if (latestVersionRecord != null) - { - // indicate that this is the 'final' record version - PropertyMap versionRecordProps = new PropertyMap(2); - versionRecordProps.put(RecordableVersionModel.PROP_VERSION_LABEL, I18NUtil.getMessage(FINAL_VERSION)); - versionRecordProps.put(RecordableVersionModel.PROP_VERSION_DESCRIPTION, I18NUtil.getMessage(FINAL_DESCRIPTION)); - nodeService.addAspect(nodeRef, RecordableVersionModel.ASPECT_VERSION_RECORD, versionRecordProps); - - // link to previous version - relationshipService.addRelationship(CUSTOM_REF_VERSIONS.getLocalName(), nodeRef, latestVersionRecord); - } - if (isLinked) { // turn off rules @@ -945,11 +812,9 @@ public class RecordServiceImpl extends BaseBehaviourBean // set the extended security Set combinedWriters = new HashSet(writers); - if (owner != null && !owner.isEmpty() && !owner.equals(OwnableService.NO_OWNER)) - { - combinedWriters.add(owner); - } + combinedWriters.add(owner); combinedWriters.add(AuthenticationUtil.getFullyAuthenticatedUser()); + extendedSecurityService.addExtendedSecurity(nodeRef, readers, combinedWriters); } finally @@ -969,130 +834,6 @@ public class RecordServiceImpl extends BaseBehaviourBean }); } - /** - * @see org.alfresco.module.org_alfresco_module_rm.record.RecordService#createRecordFromCopy(org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - public NodeRef createRecordFromCopy(final NodeRef filePlan, final NodeRef nodeRef) - { - return authenticationUtil.runAsSystem(new RunAsWork() - { - public NodeRef doWork() throws Exception - { - // get the unfiled record folder - final NodeRef unfiledRecordFolder = filePlanService.getUnfiledContainer(filePlan); - - // get the documents readers - Long aclId = nodeService.getNodeAclId(nodeRef); - Set readers = extendedPermissionService.getReaders(aclId); - Set writers = extendedPermissionService.getWriters(aclId); - - // add the current owner to the list of extended writers - Set modifiedWrtiers = new HashSet(writers); - if (nodeService.hasAspect(nodeRef, ContentModel.ASPECT_OWNABLE)) - { - String owner = ownableService.getOwner(nodeRef); - if (owner != null && !owner.isEmpty() && !owner.equals(OwnableService.NO_OWNER)) - { - modifiedWrtiers.add(owner); - } - } - - // add the current user as extended writer - modifiedWrtiers.add(authenticationUtil.getFullyAuthenticatedUser()); - - // copy version state and create record - NodeRef record = null; - try - { - List originalAssocs = null; - if (nodeService.hasAspect(nodeRef, ContentModel.ASPECT_COPIEDFROM)) - { - // take a note of any copyFrom information already on the node - originalAssocs = nodeService.getTargetAssocs(nodeRef, ContentModel.ASSOC_ORIGINAL); - } - - recordsManagementContainerType.disable(); - try - { - // create a copy of the original state and add it to the unfiled record container - FileInfo recordInfo = fileFolderService.copy(nodeRef, unfiledRecordFolder, null); - record = recordInfo.getNodeRef(); - } - finally - { - recordsManagementContainerType.enable(); - } - - // make record - makeRecord(record); - - // remove added copy assocs - List recordAssocs = nodeService.getTargetAssocs(record, ContentModel.ASSOC_ORIGINAL); - for (AssociationRef recordAssoc : recordAssocs) - { - nodeService.removeAssociation( - recordAssoc.getSourceRef(), - recordAssoc.getTargetRef(), - ContentModel.ASSOC_ORIGINAL); - } - - // re-add origional assocs or remove aspect - if (originalAssocs == null) - { - nodeService.removeAspect(record, ContentModel.ASPECT_COPIEDFROM); - } - else - { - for (AssociationRef originalAssoc : originalAssocs) - { - nodeService.createAssociation(originalAssoc.getSourceRef(), originalAssoc.getTargetRef(), ContentModel.ASSOC_ORIGINAL); - } - } - } - catch (FileNotFoundException e) - { - throw new AlfrescoRuntimeException("Can't create recorded version, because copy fails.", e); - } - - // set extended security on record - extendedSecurityService.addExtendedSecurity(record, readers, writers); - - return record; - } - }); - } - - /** - * Helper to get the latest version record for a given document (ie non-record) - * - * @param nodeRef node reference - * @return NodeRef latest version record, null otherwise - */ - private NodeRef getLatestVersionRecord(NodeRef nodeRef) - { - NodeRef versionRecord = null; - - // wire record up to previous record - VersionHistory versionHistory = versionService.getVersionHistory(nodeRef); - if (versionHistory != null) - { - Collection previousVersions = versionHistory.getAllVersions(); - for (Version previousVersion : previousVersions) - { - // look for the associated record - final NodeRef previousRecord = (NodeRef)previousVersion.getVersionProperties().get(RecordableVersionServiceImpl.PROP_VERSION_RECORD); - if (previousRecord != null) - { - versionRecord = previousRecord; - break; - } - } - } - - return versionRecord; - } - /** * @see org.alfresco.module.org_alfresco_module_rm.record.RecordService#createNewRecord(org.alfresco.service.cmr.repository.NodeRef, java.lang.String, org.alfresco.service.namespace.QName, java.util.Map, org.alfresco.service.cmr.repository.ContentReader) */ @@ -1102,7 +843,7 @@ public class RecordServiceImpl extends BaseBehaviourBean ParameterCheck.mandatory("nodeRef", parent); ParameterCheck.mandatory("name", name); - NodeRef result = null; + NodeRef record = null; NodeRef destination = parent; if (isFilePlan(parent)) @@ -1129,7 +870,7 @@ public class RecordServiceImpl extends BaseBehaviourBean try { // create the new record - final NodeRef record = fileFolderService.create(destination, name, type).getNodeRef(); + record = fileFolderService.create(destination, name, type).getNodeRef(); // set the properties if (properties != null) @@ -1145,32 +886,23 @@ public class RecordServiceImpl extends BaseBehaviourBean writer.setMimetype(reader.getMimetype()); writer.putContent(reader); } - - result = authenticationUtil.runAsSystem(new RunAsWork() - { - public NodeRef doWork() throws Exception - { - // Check if the "record" aspect has been applied already. - // In case of filing a report the created node will be made - // a record within the "onCreateChildAssociation" method if - // a destination for the report has been selected. - if (!nodeService.hasAspect(record, ASPECT_RECORD)) - { - // make record - makeRecord(record); - } - - return record; - } - - }); } finally { enablePropertyEditableCheck(); } - return result; + // Check if the "record" aspect has been applied already. + // In case of filing a report the created node will be made + // a record within the "onCreateChildAssociation" method if + // a destination for the report has been selected. + if (!nodeService.hasAspect(record, ASPECT_RECORD)) + { + // make record + makeRecord(record); + } + + return record; } /** @@ -1224,12 +956,6 @@ public class RecordServiceImpl extends BaseBehaviourBean props.put(PROP_IDENTIFIER, recordId); props.put(PROP_ORIGIONAL_NAME, name); nodeService.addAspect(document, RecordsManagementModel.ASPECT_RECORD, props); - - // remove versionable aspect(s) - nodeService.removeAspect(document, RecordableVersionModel.ASPECT_VERSIONABLE); - - // remove the owner - ownableService.setOwner(document, OwnableService.NO_OWNER); } catch (FileNotFoundException e) { @@ -1255,7 +981,15 @@ public class RecordServiceImpl extends BaseBehaviourBean if (isRecord(nodeRef)) { - result = (null != nodeService.getProperty(nodeRef, PROP_DATE_FILED)); + ChildAssociationRef childAssocRef = nodeService.getPrimaryParent(nodeRef); + if (childAssocRef != null) + { + NodeRef parent = childAssocRef.getParentRef(); + if (parent != null && recordFolderService.isRecordFolder(parent)) + { + result = true; + } + } } return result; @@ -1302,6 +1036,41 @@ public class RecordServiceImpl extends BaseBehaviourBean } } + /** + * @see org.alfresco.module.org_alfresco_module_rm.record.RecordService#hideRecord(org.alfresco.service.cmr.repository.NodeRef) + */ + @Override + public void hideRecord(final NodeRef nodeRef) + { + ParameterCheck.mandatory("NodeRef", nodeRef); + + // do the work of hiding the record as the system user + AuthenticationUtil.runAsSystem(new RunAsWork() + { + @Override + public Void doWork() + { + // remove the child association + NodeRef originatingLocation = (NodeRef) nodeService.getProperty(nodeRef, PROP_RECORD_ORIGINATING_LOCATION); + List parentAssocs = nodeService.getParentAssocs(nodeRef); + for (ChildAssociationRef childAssociationRef : parentAssocs) + { + if (!childAssociationRef.isPrimary() && childAssociationRef.getParentRef().equals(originatingLocation)) + { + nodeService.removeChildAssociation(childAssociationRef); + break; + } + } + + // remove the extended security from the node + // this prevents the users from continuing to see the record in searchs and other linked locations + extendedSecurityService.removeAllExtendedSecurity(nodeRef); + + return null; + } + }); + } + /** * @see org.alfresco.module.org_alfresco_module_rm.record.RecordService#rejectRecord(org.alfresco.service.cmr.repository.NodeRef, java.lang.String) */ @@ -1323,26 +1092,18 @@ public class RecordServiceImpl extends BaseBehaviourBean ruleService.disableRules(); try { - // get the latest version record, if there is one - NodeRef latestVersionRecord = getLatestVersionRecord(nodeRef); - - if (latestVersionRecord != null) - { - relationshipService.removeRelationship(CUSTOM_REF_VERSIONS.getLocalName(), nodeRef, latestVersionRecord); - } - // get record property values - final Map properties = nodeService.getProperties(nodeRef); - final String recordId = (String)properties.get(PROP_IDENTIFIER); - final String documentOwner = (String)properties.get(PROP_RECORD_ORIGINATING_USER_ID); - final String originalName = (String)properties.get(PROP_ORIGIONAL_NAME); - final NodeRef originatingLocation = (NodeRef)properties.get(PROP_RECORD_ORIGINATING_LOCATION); + Map properties = nodeService.getProperties(nodeRef); + String recordId = (String)properties.get(PROP_IDENTIFIER); + String documentOwner = (String)properties.get(PROP_RECORD_ORIGINATING_USER_ID); + String origionalName = (String)properties.get(PROP_ORIGIONAL_NAME); + NodeRef originatingLocation = (NodeRef)properties.get(PROP_RECORD_ORIGINATING_LOCATION); // we can only reject if the originating location is present if (originatingLocation != null) { // first remove the secondary link association - final List parentAssocs = nodeService.getParentAssocs(nodeRef); + List parentAssocs = nodeService.getParentAssocs(nodeRef); for (ChildAssociationRef childAssociationRef : parentAssocs) { if (!childAssociationRef.isPrimary() && childAssociationRef.getParentRef().equals(originatingLocation)) @@ -1352,28 +1113,37 @@ public class RecordServiceImpl extends BaseBehaviourBean } } - removeRmAspectsFrom(nodeRef); + // remove all RM related aspects from the node + Set aspects = nodeService.getAspects(nodeRef); + for (QName aspect : aspects) + { + if (RM_URI.equals(aspect.getNamespaceURI())) + { + // remove the aspect + nodeService.removeAspect(nodeRef, aspect); + } + } // get the records primary parent association - final ChildAssociationRef parentAssoc = nodeService.getPrimaryParent(nodeRef); + ChildAssociationRef parentAssoc = nodeService.getPrimaryParent(nodeRef); // move the record into the collaboration site nodeService.moveNode(nodeRef, originatingLocation, ContentModel.ASSOC_CONTAINS, parentAssoc.getQName()); - // rename to the original name - if (originalName != null) + // rename to the origional name + if (origionalName != null) { - fileFolderService.rename(nodeRef, originalName); + fileFolderService.rename(nodeRef, origionalName); if (logger.isDebugEnabled()) { String name = (String)nodeService.getProperty(nodeRef, ContentModel.PROP_NAME); - logger.debug("Rename " + name + " to " + originalName); + logger.debug("Rename " + name + " to " + origionalName); } } // save the information about the rejection details - final Map aspectProperties = new HashMap<>(3); + Map aspectProperties = new HashMap(3); aspectProperties.put(PROP_RECORD_REJECTION_USER_ID, userId); aspectProperties.put(PROP_RECORD_REJECTION_DATE, new Date()); aspectProperties.put(PROP_RECORD_REJECTION_REASON, reason); @@ -1403,35 +1173,6 @@ public class RecordServiceImpl extends BaseBehaviourBean return null; } - - /** Removes all RM related aspects from the specified node and any rendition children. */ - private void removeRmAspectsFrom(NodeRef nodeRef) - { - // Note that when folder records are supported, we will need to recursively - // remove aspects from their descendants. - final Set aspects = nodeService.getAspects(nodeRef); - for (QName aspect : aspects) - { - if (RM_URI.equals(aspect.getNamespaceURI()) || - RecordableVersionModel.RMV_URI.equals(aspect.getNamespaceURI())) - { - nodeService.removeAspect(nodeRef, aspect); - } - } - for (ChildAssociationRef renditionAssoc : renditionService.getRenditions(nodeRef)) - { - final NodeRef renditionNode = renditionAssoc.getChildRef(); - - // Do not attempt to clean up rendition nodes which are not children of their source node. - final boolean renditionRequiresCleaning = nodeService.exists(renditionNode) && - renditionAssoc.isPrimary(); - - if (renditionRequiresCleaning) - { - removeRmAspectsFrom(renditionNode); - } - } - } }); } @@ -1449,51 +1190,63 @@ public class RecordServiceImpl extends BaseBehaviourBean throw new AlfrescoRuntimeException("Can not check if the property " + property.toString() + " is editable, because node reference is not a record."); } - NodeRef filePlan = getFilePlan(record); - - // DEBUG ... - boolean debugEnabled = logger.isDebugEnabled(); - if (debugEnabled) + if (logger.isDebugEnabled()) { logger.debug("Checking whether property " + property.toString() + " is editable for user " + AuthenticationUtil.getRunAsUser()); + } - Set roles = filePlanRoleService.getRolesByUser(filePlan, AuthenticationUtil.getRunAsUser()); + // DEBUG ... + NodeRef filePlan = getFilePlan(record); + Set roles = filePlanRoleService.getRolesByUser(filePlan, AuthenticationUtil.getRunAsUser()); + if (logger.isDebugEnabled()) + { logger.debug(" ... users roles"); + } - for (Role role : roles) + for (Role role : roles) + { + if (logger.isDebugEnabled()) { logger.debug(" ... user has role " + role.getName() + " with capabilities "); + } - for (Capability cap : role.getCapabilities()) + for (Capability cap : role.getCapabilities()) + { + if (logger.isDebugEnabled()) { logger.debug(" ... " + cap.getName()); } } + } + if (logger.isDebugEnabled()) + { logger.debug(" ... user has the following set permissions on the file plan"); - - Set perms = permissionService.getAllSetPermissions(filePlan); - for (AccessPermission perm : perms) + } + Set perms = permissionService.getAllSetPermissions(filePlan); + for (AccessPermission perm : perms) + { + if (logger.isDebugEnabled() && + (perm.getPermission().contains(RMPermissionModel.EDIT_NON_RECORD_METADATA) || + perm.getPermission().contains(RMPermissionModel.EDIT_RECORD_METADATA))) { - if ((perm.getPermission().contains(RMPermissionModel.EDIT_NON_RECORD_METADATA) || - perm.getPermission().contains(RMPermissionModel.EDIT_RECORD_METADATA))) - { - logger.debug(" ... " + perm.getAuthority() + " - " + perm.getPermission() + " - " + perm.getAccessStatus().toString()); - } - } - - if (permissionService.hasPermission(filePlan, RMPermissionModel.EDIT_NON_RECORD_METADATA).equals(AccessStatus.ALLOWED)) - { - logger.debug(" ... user has the edit non record metadata permission on the file plan"); + logger.debug(" ... " + perm.getAuthority() + " - " + perm.getPermission() + " - " + perm.getAccessStatus().toString()); } } + + if (permissionService.hasPermission(filePlan, RMPermissionModel.EDIT_NON_RECORD_METADATA).equals(AccessStatus.ALLOWED) && + logger.isDebugEnabled()) + { + logger.debug(" ... user has the edit non record metadata permission on the file plan"); + } + // END DEBUG ... boolean result = alwaysEditProperty(property); if (result) { - if (debugEnabled) + if (logger.isDebugEnabled()) { logger.debug(" ... property marked as always editable."); } @@ -1509,7 +1262,7 @@ public class RecordServiceImpl extends BaseBehaviourBean if (AccessStatus.ALLOWED.equals(accessNonRecord)) { - if (debugEnabled) + if (logger.isDebugEnabled()) { logger.debug(" ... user has edit nonrecord metadata capability"); } @@ -1520,7 +1273,7 @@ public class RecordServiceImpl extends BaseBehaviourBean if (AccessStatus.ALLOWED.equals(accessRecord) || AccessStatus.ALLOWED.equals(accessDeclaredRecord)) { - if (debugEnabled) + if (logger.isDebugEnabled()) { logger.debug(" ... user has edit record or declared metadata capability"); } @@ -1530,7 +1283,7 @@ public class RecordServiceImpl extends BaseBehaviourBean if (allowNonRecordEdit && allowRecordEdit) { - if (debugEnabled) + if (logger.isDebugEnabled()) { logger.debug(" ... so all properties can be edited."); } @@ -1542,7 +1295,7 @@ public class RecordServiceImpl extends BaseBehaviourBean // can only edit non record properties if (!isRecordMetadata(filePlan, property)) { - if (debugEnabled) + if (logger.isDebugEnabled()) { logger.debug(" ... property is not considered record metadata so editable."); } @@ -1551,7 +1304,7 @@ public class RecordServiceImpl extends BaseBehaviourBean } else { - if (debugEnabled) + if (logger.isDebugEnabled()) { logger.debug(" ... property is considered record metadata so not editable."); } @@ -1562,7 +1315,7 @@ public class RecordServiceImpl extends BaseBehaviourBean // can only edit record properties if (isRecordMetadata(filePlan, property)) { - if (debugEnabled) + if (logger.isDebugEnabled()) { logger.debug(" ... property is considered record metadata so editable."); } @@ -1571,7 +1324,7 @@ public class RecordServiceImpl extends BaseBehaviourBean } else { - if (debugEnabled) + if (logger.isDebugEnabled()) { logger.debug(" ... property is not considered record metadata so not editable."); } @@ -1609,7 +1362,7 @@ public class RecordServiceImpl extends BaseBehaviourBean else { // check the URI's - result = RECORD_MODEL_URIS.contains(property.getNamespaceURI()); + result = ArrayUtils.contains(RECORD_MODEL_URIS, property.getNamespaceURI()); // check the custom model if (!result && !ArrayUtils.contains(NON_RECORD_MODEL_URIS, property.getNamespaceURI())) @@ -1712,128 +1465,14 @@ public class RecordServiceImpl extends BaseBehaviourBean * @see org.alfresco.module.org_alfresco_module_rm.record.RecordService#link(NodeRef, NodeRef) */ @Override - public void link(NodeRef record, NodeRef recordFolder) + public void link(NodeRef nodeRef, NodeRef folder) { - ParameterCheck.mandatory("record", record); - ParameterCheck.mandatory("recordFolder", recordFolder); + ParameterCheck.mandatory("nodeRef", nodeRef); + ParameterCheck.mandatory("folder", folder); - // ensure we are linking a record to a record folder - if(isRecord(record) && isRecordFolder(recordFolder)) + if(isRecord(nodeRef) && isRecordFolder(folder)) { - // ensure that we are not linking a record to an exisiting location - List parents = nodeService.getParentAssocs(record); - for (ChildAssociationRef parent : parents) - { - if (parent.getParentRef().equals(recordFolder)) - { - // we can not link a record to the same location more than once - throw new RecordLinkRuntimeException("Can not link a record to the same record folder more than once"); - } - } - - // validate link conditions - validateLinkConditions(record, recordFolder); - - // get the current name of the record - String name = nodeService.getProperty(record, ContentModel.PROP_NAME).toString(); - - // create a secondary link to the record folder - nodeService.addChild( - recordFolder, - record, - ContentModel.ASSOC_CONTAINS, - QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, name)); - } - else - { - // can only link a record to a record folder - throw new RecordLinkRuntimeException("Can only link a record to a record folder."); - } - } - - /** - * - * @param record - * @param recordFolder - */ - private void validateLinkConditions(NodeRef record, NodeRef recordFolder) - { - // ensure that the linking record folders have compatible disposition schedules - DispositionSchedule recordDispositionSchedule = dispositionService.getDispositionSchedule(record); - if (recordDispositionSchedule != null) - { - DispositionSchedule recordFolderDispositionSchedule = dispositionService.getDispositionSchedule(recordFolder); - if (recordFolderDispositionSchedule != null) - { - if (recordDispositionSchedule.isRecordLevelDisposition() != recordFolderDispositionSchedule.isRecordLevelDisposition()) - { - // we can't link a record to an incompatible disposition schedule - throw new RecordLinkRuntimeException("Can not link a record to a record folder with an incompatible disposition schedule. " - + "They must either both be record level or record folder level dispositions."); - } - } - } - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.record.RecordService#unlink(org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - public void unlink(NodeRef record, NodeRef recordFolder) - { - ParameterCheck.mandatory("record", record); - ParameterCheck.mandatory("recordFolder", recordFolder); - - // ensure we are unlinking a record from a record folder - if(isRecord(record) && isRecordFolder(recordFolder)) - { - // check that we are not trying to unlink the primary parent - NodeRef primaryParent = nodeService.getPrimaryParent(record).getParentRef(); - if (primaryParent.equals(recordFolder)) - { - throw new RecordLinkRuntimeException("Can't unlink a record from it's owning record folder."); - } - - // remove the link - nodeService.removeChild(recordFolder, record); - } - else - { - // can only unlink a record from a record folder - throw new RecordLinkRuntimeException("Can only unlink a record from a record folder."); - } - } - - /** - * @see org.alfresco.repo.node.NodeServicePolicies.BeforeDeleteNodePolicy#beforeDeleteNode(org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - @Behaviour - ( - kind = BehaviourKind.CLASS, - type = "rma:record" - ) - public void beforeDeleteNode(NodeRef nodeRef) - { - final NodeRef versionedNodeRef = (NodeRef) nodeService.getProperty(nodeRef, PROP_VERSIONED_NODEREF); - if (versionedNodeRef != null) - { - String versionLabel = (String) nodeService.getProperty(nodeRef, PROP_VERSION_LABEL); - if (isNotBlank(versionLabel)) - { - final Version version = versionService.getVersionHistory(versionedNodeRef).getVersion(versionLabel); - - AuthenticationUtil.runAsSystem(new RunAsWork() - { - @Override - public Void doWork() - { - versionService.deleteVersion(versionedNodeRef, version); - - return null; - } - }); - } + nodeService.addChild(folder, nodeRef, ContentModel.ASSOC_CONTAINS, QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, nodeService.getProperty(nodeRef, ContentModel.PROP_NAME).toString())); } } } diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/recordableversion/RecordableVersionConfigService.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/recordableversion/RecordableVersionConfigService.java deleted file mode 100644 index 1d5b759e45..0000000000 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/recordableversion/RecordableVersionConfigService.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright (C) 2005-2014 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - */ -package org.alfresco.module.org_alfresco_module_rm.recordableversion; - -import java.util.List; - -import org.alfresco.module.org_alfresco_module_rm.script.slingshot.Version; -import org.alfresco.service.cmr.repository.NodeRef; - -/** - * Recordable version config service interface - * - * @author Tuna Aksoy - * @since 2.3 - */ -public interface RecordableVersionConfigService -{ - /** - * Gets the recordable versions - * - * @param nodeRef The node reference for which the recordable versions should be retrieved - * @return The list of recordable versions - */ - List getVersions(NodeRef nodeRef); - - /** - * Sets the recordable version for the given node - * - * @param nodeRef The node reference for which the recorable version should be set - * @param version The version to be set - */ - void setVersion(NodeRef nodeRef, String version); -} diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/recordableversion/RecordableVersionConfigServiceImpl.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/recordableversion/RecordableVersionConfigServiceImpl.java deleted file mode 100644 index a73e03a06c..0000000000 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/recordableversion/RecordableVersionConfigServiceImpl.java +++ /dev/null @@ -1,127 +0,0 @@ -/* - * Copyright (C) 2005-2014 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - */ -package org.alfresco.module.org_alfresco_module_rm.recordableversion; - -import static org.alfresco.module.org_alfresco_module_rm.version.RecordableVersionPolicy.NONE; -import static org.alfresco.util.ParameterCheck.mandatory; -import static org.alfresco.util.ParameterCheck.mandatoryString; -import static org.apache.commons.lang.StringUtils.isNotBlank; - -import java.util.ArrayList; -import java.util.List; - -import org.alfresco.module.org_alfresco_module_rm.script.slingshot.Version; -import org.alfresco.module.org_alfresco_module_rm.version.RecordableVersionModel; -import org.alfresco.module.org_alfresco_module_rm.version.RecordableVersionPolicy; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.repository.NodeService; - -/** - * Recordable version config service - * - * @author Tuna Aksoy - * @since 2.3 - */ -public class RecordableVersionConfigServiceImpl implements RecordableVersionConfigService, RecordableVersionModel -{ - /** Node service */ - private NodeService nodeService; - - /** - * Gets the node service - * - * @return The node service - */ - protected NodeService getNodeService() - { - return this.nodeService; - } - - /** - * Sets the node service - * - * @param nodeService The node service - */ - public void setNodeService(NodeService nodeService) - { - this.nodeService = nodeService; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.recordableversion.RecordableVersionConfigService#getVersions(org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - public List getVersions(NodeRef nodeRef) - { - mandatory("nodeRef", nodeRef); - - RecordableVersionPolicy[] recordableVersionPolicies = RecordableVersionPolicy.values(); - List versions = new ArrayList(recordableVersionPolicies.length); - - for (RecordableVersionPolicy recordableVersionPolicy : recordableVersionPolicies) - { - String policy = recordableVersionPolicy.toString(); - boolean selected = isVersionPolicySelected(recordableVersionPolicy, nodeRef); - versions.add(new Version(policy, selected)); - } - - return versions; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.recordableversion.RecordableVersionConfigService#setVersion(org.alfresco.service.cmr.repository.NodeRef, java.lang.String) - */ - @Override - public void setVersion(NodeRef nodeRef, String version) - { - mandatory("nodeRef", nodeRef); - mandatoryString("recordedVersion", version); - - RecordableVersionPolicy recordableVersionPolicy = RecordableVersionPolicy.valueOf(version); - getNodeService().setProperty(nodeRef, PROP_RECORDABLE_VERSION_POLICY, recordableVersionPolicy); - } - - /** - * Checks if the specified recordable version policy has been selected for the document - * - * @param recordableVersionPolicy The recordable version policy - * @param nodeRef Node reference of the document - * @return true if the specified recordable version policy has been selected for the document, false otherwise - */ - private boolean isVersionPolicySelected(RecordableVersionPolicy recordableVersionPolicy, NodeRef nodeRef) - { - boolean isVersionPolicySelected = false; - String policy = (String) getNodeService().getProperty(nodeRef, PROP_RECORDABLE_VERSION_POLICY); - if (isNotBlank(policy)) - { - if (RecordableVersionPolicy.valueOf(policy).equals(recordableVersionPolicy)) - { - isVersionPolicySelected = true; - } - } - else - { - if (recordableVersionPolicy.equals(NONE)) - { - isVersionPolicySelected = true; - } - } - return isVersionPolicySelected; - } -} diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/relationship/Relationship.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/relationship/Relationship.java deleted file mode 100644 index 7265491122..0000000000 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/relationship/Relationship.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright (C) 2005-2014 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - */ -package org.alfresco.module.org_alfresco_module_rm.relationship; - -import org.alfresco.service.cmr.repository.NodeRef; - -/** - * Interface representing the relationship - * - * @author Tuna Aksoy - * @since 2.3 - */ -public interface Relationship -{ - /** - * Gets the unique name of the relationship - * - * @return The unique name of the relationship - */ - String getUniqueName(); - - /** - * Gets the source of the relationship - * - * @return The source of the relationship - */ - NodeRef getSource(); - - /** - * Gets the target of the relationship - * - * @return The target of the relationship - */ - NodeRef getTarget(); -} diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/relationship/RelationshipDefinition.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/relationship/RelationshipDefinition.java deleted file mode 100644 index 0a2ad1e943..0000000000 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/relationship/RelationshipDefinition.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright (C) 2005-2014 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - */ -package org.alfresco.module.org_alfresco_module_rm.relationship; - -/** - * Interface representing the relationship definition - * - * @author Tuna Aksoy - * @since 2.3 - */ -public interface RelationshipDefinition -{ - /** - * Gets the unique name of the relationship definition - * - * @return The unique name of the relationship definition - */ - String getUniqueName(); - - /** - * Gets the type of the relationship definition - * - * @return The type of the relationship definition - */ - RelationshipType getType(); - - /** - * Gets the display name of the relationship definition - * - * @return The display name of the relationship definition - */ - RelationshipDisplayName getDisplayName(); -} diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/relationship/RelationshipDefinitionImpl.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/relationship/RelationshipDefinitionImpl.java deleted file mode 100644 index 3b90dec107..0000000000 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/relationship/RelationshipDefinitionImpl.java +++ /dev/null @@ -1,115 +0,0 @@ -/* - * Copyright (C) 2005-2014 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - */ -package org.alfresco.module.org_alfresco_module_rm.relationship; - -import static org.alfresco.util.ParameterCheck.mandatory; -import static org.alfresco.util.ParameterCheck.mandatoryString; - -/** - * Relationship definition implementation - * - * @author Tuna Aksoy - * @since 2.3 - */ -public class RelationshipDefinitionImpl implements RelationshipDefinition -{ - /** The unique name of the relationship definition */ - private String uniqueName; - - /** The type of the relationship definition */ - private RelationshipType type; - - /** The display name of the relationship definition */ - private RelationshipDisplayName displayName; - - /** - * Constructor for creating a relationship definition - * - * @param uniqueName The unique name of the relationship definition - * @param type The type of the relationship definition - * @param displayName The display name of the relationship definition - */ - public RelationshipDefinitionImpl(String uniqueName, RelationshipType type, RelationshipDisplayName displayName) - { - mandatoryString("uniqueName", uniqueName); - mandatory("type", type); - mandatory("displayName", displayName); - - setUniqueName(uniqueName); - setType(type); - setDisplayName(displayName); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.relationship.RelationshipDefinition#getUniqueName() - */ - @Override - public String getUniqueName() - { - return this.uniqueName; - } - - /** - * Sets the name of the relationship definition - * - * @param uniqueName The name of the relationship definition - */ - private void setUniqueName(String uniqueName) - { - this.uniqueName = uniqueName; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.relationship.RelationshipDefinition#getType() - */ - @Override - public RelationshipType getType() - { - return this.type; - } - - /** - * Sets the type of the relationship definition - * - * @param type The type of the relationship definition - */ - private void setType(RelationshipType type) - { - this.type = type; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.relationship.RelationshipDefinition#getDisplayName() - */ - @Override - public RelationshipDisplayName getDisplayName() - { - return this.displayName; - } - - /** - * Sets the display name of the relationship definition - * - * @param displayName The display name of the relationship definition - */ - private void setDisplayName(RelationshipDisplayName displayName) - { - this.displayName = displayName; - } -} diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/relationship/RelationshipDisplayName.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/relationship/RelationshipDisplayName.java deleted file mode 100644 index 2ed160e07a..0000000000 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/relationship/RelationshipDisplayName.java +++ /dev/null @@ -1,107 +0,0 @@ -/* - * Copyright (C) 2005-2014 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - */ -package org.alfresco.module.org_alfresco_module_rm.relationship; - -import static org.alfresco.util.ParameterCheck.mandatoryString; - -/** - * POJO representing the relationship display name - * - * @author Tuna Aksoy - * @since 2.3 - */ -public class RelationshipDisplayName -{ - /** The source text of the relationship */ - private String sourceText; - - /** The target text of the relationship */ - private String targetText; - - /** - * Constructor for creating the relationship display name. - * In case of a bidirectional relationship the source - * text and target text will be the same. - * - * @param sourceText The source text of the relationship - * @param targetText The target text of the relationship - */ - public RelationshipDisplayName(String sourceText, String targetText) - { - mandatoryString("sourceText", sourceText); - mandatoryString("targetText", targetText); - - setSourceText(sourceText); - setTargetText(targetText); - } - - /** - * Gets the source text of the relationship - * - * @return The source text of the relationship - */ - public String getSourceText() - { - return this.sourceText; - } - - /** - * Sets the source text of the relationship - * - * @param sourceText The source text of the relationship - */ - private void setSourceText(String sourceText) - { - this.sourceText = sourceText; - } - - /** - * Gets the target text of the relationship - * - * @return The target text of the relationship - */ - public String getTargetText() - { - return this.targetText; - } - - /** - * Sets the target text of the relationship - * - * @param targetText The target text of the relationship - */ - private void setTargetText(String targetText) - { - this.targetText = targetText; - } - - /** - * @see java.lang.Object#toString() - */ - @Override - public String toString() - { - StringBuilder sb = new StringBuilder(); - sb.append("(") - .append("source=").append(sourceText) - .append(", target=").append(targetText) - .append(")"); - return sb.toString(); - } -} diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/relationship/RelationshipImpl.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/relationship/RelationshipImpl.java deleted file mode 100644 index 118f83a197..0000000000 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/relationship/RelationshipImpl.java +++ /dev/null @@ -1,117 +0,0 @@ -/* - * Copyright (C) 2005-2014 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - */ -package org.alfresco.module.org_alfresco_module_rm.relationship; - -import static org.alfresco.util.ParameterCheck.mandatory; -import static org.alfresco.util.ParameterCheck.mandatoryString; - -import org.alfresco.service.cmr.repository.NodeRef; - -/** - * Relationship implementation - * - * @author Tuna Aksoy - * @since 2.3 - */ -public class RelationshipImpl implements Relationship -{ - /** The unique name of the relationship */ - private String uniqueName; - - /** The source of the relationship */ - private NodeRef source; - - /** The target of the relationship */ - private NodeRef target; - - /** - * Constructor for creating a relationship - * - * @param uniqueName The unique name of the relationship - * @param source The source of the relationship - * @param target The target of the relationship - */ - public RelationshipImpl(String uniqueName, NodeRef source, NodeRef target) - { - mandatoryString("uniqueName", uniqueName); - mandatory("source", source); - mandatory("target", target); - - setUniqueName(uniqueName); - setSource(source); - setTarget(target); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.relationship.Relationship#getUniqueName() - */ - @Override - public String getUniqueName() - { - return uniqueName; - } - - /** - * Sets the unique name of the relationship - * - * @param uniqueName The unique name of the relationship - */ - private void setUniqueName(String uniqueName) - { - this.uniqueName = uniqueName; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.relationship.Relationship#getSource() - */ - @Override - public NodeRef getSource() - { - return source; - } - - /** - * Sets the source of the relationship - * - * @param source The source of the relationship - */ - private void setSource(NodeRef source) - { - this.source = source; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.relationship.Relationship#getTarget() - */ - @Override - public NodeRef getTarget() - { - return target; - } - - /** - * Sets the target of the relationship - * - * @param target The target of the relationship - */ - private void setTarget(NodeRef target) - { - this.target = target; - } -} diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/relationship/RelationshipService.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/relationship/RelationshipService.java deleted file mode 100644 index 0a619f53d1..0000000000 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/relationship/RelationshipService.java +++ /dev/null @@ -1,116 +0,0 @@ -/* - * Copyright (C) 2005-2014 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - */ -package org.alfresco.module.org_alfresco_module_rm.relationship; - -import java.util.Set; - -import org.alfresco.service.cmr.repository.NodeRef; - -/** - * The relationship service interface - * - * @author Tuna Aksoy - * @since 2.3 - */ -public interface RelationshipService -{ - /** - * Gets all the existing relationship definitions - * - * @return All existing relationship definitions - */ - Set getRelationshipDefinitions(); - - /** - * Gets the relationship definition for the given unique name - * - * @param uniqueName The unique name of the relationship definition - * @return The relationship definition for the given unique name if it exist, null otherwise - */ - RelationshipDefinition getRelationshipDefinition(String uniqueName); - - /** - * Creates a relationship definition using the display name - * - * @param displayName The display name of the relationship definition - * @return The new relationship definition - */ - RelationshipDefinition createRelationshipDefinition(RelationshipDisplayName displayName); - - /** - * Updates an existing relationship definition - * - * @param uniqueName The unique name of the relationship definition - * @param displayName The display name of the relationship definition - * @return The updated relationship definition - */ - RelationshipDefinition updateRelationshipDefinition(String uniqueName, RelationshipDisplayName displayName); - - /** - * Removes a relationship definition - * - * @param uniqueName The unique name of the relationship definition - * @return true if the relationship definition was removed successfully, false otherwise - */ - boolean removeRelationshipDefinition(String uniqueName); - - /** - * Checks if a relationship exists or not - * - * @param uniqueName The unique name of the relationship definition - * @return true if the relationship definition exists, false otherwise - */ - boolean existsRelationshipDefinition(String uniqueName); - - /** - * Gets all the relationships that come out from the given node reference - * - * @param nodeRef The node reference - * @return All relationships that come out from the given node reference - */ - Set getRelationshipsFrom(NodeRef nodeRef); - - /** - * Gets all the relationships that go in to the given node reference - * - * @param nodeRef The node reference - * @return All relationships that go in to the given node reference - */ - Set getRelationshipsTo(NodeRef nodeRef); - - /** - * Adds a relationship from the given node source - * to the give node target with the given unique name - * - * @param uniqueName The unique name of the relationship - * @param source The node reference which the relationship come from - * @param target The node reference which the relationship go to - */ - void addRelationship(String uniqueName, NodeRef source, NodeRef target); - - /** - * Removes the relationship from the given node source - * to the given node target with the given unique name - * - * @param uniqueName The unique name of the relationship - * @param source The node reference which the relationship come from - * @param target The node reference which the relationship go to - */ - void removeRelationship(String uniqueName, NodeRef source, NodeRef target); -} diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/relationship/RelationshipServiceImpl.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/relationship/RelationshipServiceImpl.java deleted file mode 100644 index 92b4fa7be4..0000000000 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/relationship/RelationshipServiceImpl.java +++ /dev/null @@ -1,928 +0,0 @@ -/* - * Copyright (C) 2005-2014 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - */ -package org.alfresco.module.org_alfresco_module_rm.relationship; - -import static org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel.ASPECT_FROZEN; -import static org.alfresco.util.ParameterCheck.mandatory; -import static org.alfresco.util.ParameterCheck.mandatoryString; -import static org.apache.commons.lang.StringUtils.isBlank; - -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; -import java.util.Set; - -import org.alfresco.error.AlfrescoRuntimeException; -import org.alfresco.model.ContentModel; -import org.alfresco.module.org_alfresco_module_rm.RecordsManagementPolicies.BeforeCreateReference; -import org.alfresco.module.org_alfresco_module_rm.RecordsManagementPolicies.BeforeRemoveReference; -import org.alfresco.module.org_alfresco_module_rm.RecordsManagementPolicies.OnCreateReference; -import org.alfresco.module.org_alfresco_module_rm.RecordsManagementPolicies.OnRemoveReference; -import org.alfresco.module.org_alfresco_module_rm.admin.RecordsManagementAdminBase; -import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; -import org.alfresco.module.org_alfresco_module_rm.util.PoliciesUtil; -import org.alfresco.repo.dictionary.M2Aspect; -import org.alfresco.repo.dictionary.M2ClassAssociation; -import org.alfresco.repo.dictionary.M2Model; -import org.alfresco.repo.policy.ClassPolicyDelegate; -import org.alfresco.repo.policy.PolicyComponent; -import org.alfresco.repo.security.authentication.AuthenticationUtil; -import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork; -import org.alfresco.service.cmr.dictionary.AssociationDefinition; -import org.alfresco.service.cmr.dictionary.ChildAssociationDefinition; -import org.alfresco.service.cmr.repository.AssociationRef; -import org.alfresco.service.cmr.repository.ChildAssociationRef; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.namespace.QName; -import org.alfresco.service.namespace.RegexQNamePattern; -import org.alfresco.util.GUID; - -/** - * The relationship service implementation - * - * @author Tuna Aksoy - * @since 2.3 - */ -public class RelationshipServiceImpl extends RecordsManagementAdminBase implements RelationshipService -{ - /** Policy component */ - private PolicyComponent policyComponent; - - /** - * Gets the policy component instance - * - * @return The policy component instance - */ - private PolicyComponent getPolicyComponent() - { - return this.policyComponent; - } - - /** - * Sets the policy component instance - * - * @param policyComponent The policy component instance - */ - public void setPolicyComponent(PolicyComponent policyComponent) - { - this.policyComponent = policyComponent; - } - - /** Policy delegates */ - private ClassPolicyDelegate beforeCreateReferenceDelegate; - private ClassPolicyDelegate onCreateReferenceDelegate; - private ClassPolicyDelegate beforeRemoveReferenceDelegate; - private ClassPolicyDelegate onRemoveReferenceDelegate; - - /** - * Initialisation method - */ - public void init() - { - // Register the various policies - beforeCreateReferenceDelegate = getPolicyComponent().registerClassPolicy(BeforeCreateReference.class); - onCreateReferenceDelegate = getPolicyComponent().registerClassPolicy(OnCreateReference.class); - beforeRemoveReferenceDelegate = getPolicyComponent().registerClassPolicy(BeforeRemoveReference.class); - onRemoveReferenceDelegate = getPolicyComponent().registerClassPolicy(OnRemoveReference.class); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.relationship.RelationshipService#getRelationshipDefinitions() - */ - @Override - public Set getRelationshipDefinitions() - { - Set relationshipDefinitions = new HashSet(); - - Set> associationsEntrySet = getCustomAssociations().entrySet(); - for (Map.Entry associationEntry : associationsEntrySet) - { - AssociationDefinition associationDefinition = associationEntry.getValue(); - RelationshipDefinition relationshipDefinition = createRelationshipDefinition(associationDefinition); - if (relationshipDefinition != null) - { - relationshipDefinitions.add(relationshipDefinition); - } - } - - return relationshipDefinitions; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.relationship.RelationshipService#getRelationshipDefinition(java.lang.String) - */ - @Override - public RelationshipDefinition getRelationshipDefinition(String uniqueName) - { - mandatoryString("uniqueName", uniqueName); - - RelationshipDefinition relationshipDefinition = null; - - AssociationDefinition associationDefinition = getAssociationDefinition(uniqueName); - if (associationDefinition != null) - { - relationshipDefinition = createRelationshipDefinition(associationDefinition); - } - - return relationshipDefinition; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.relationship.RelationshipService#createRelationshipDefinition(org.alfresco.module.org_alfresco_module_rm.relationship.RelationshipDisplayName) - */ - @Override - public RelationshipDefinition createRelationshipDefinition(RelationshipDisplayName displayName) - { - mandatory("displayName", displayName); - - String title; - RelationshipType type = determineRelationshipTypeFromDisplayName(displayName); - - switch (type) - { - case BIDIRECTIONAL: - - title = displayName.getSourceText(); - break; - - case PARENTCHILD: - - String sourceText = displayName.getSourceText(); - String targetText = displayName.getTargetText(); - title = composeAssociationDefinitionTitle(sourceText, targetText); - break; - - default: - - StringBuilder sb = new StringBuilder(); - sb.append("Unsupported relationship type: '") - .append(type.toString()) - .append("'."); - throw new AlfrescoRuntimeException(sb.toString()); - } - - // If this title is already taken... - if (existsTitle(title)) - { - StringBuilder sb = new StringBuilder(); - sb.append("Cannot create a relationship definition for the display name: '") - .append(displayName.toString()) - .append("' as there is already a relationship definition with this display name."); - throw new AlfrescoRuntimeException(sb.toString()); - } - - // Defaults to RM_CUSTOM_URI - NodeRef modelRef = getCustomModelRef(""); - M2Model deserializedModel = readCustomContentModel(modelRef); - String customAspectName = ASPECT_CUSTOM_ASSOCIATIONS.toPrefixString(getNamespaceService()); - M2Aspect customAssocsAspect = deserializedModel.getAspect(customAspectName); - - if (customAssocsAspect == null) - { - StringBuilder sb = new StringBuilder(); - sb.append("The aspect: '") - .append(customAspectName) - .append("' is undefined."); - throw new AlfrescoRuntimeException(sb.toString()); - } - - QName relationshipDefinitionQName = generateRelationshipDefinitionQNameFor(title); - String generatedShortQName = relationshipDefinitionQName.toPrefixString(getNamespaceService()); - - M2ClassAssociation customAssoc = customAssocsAspect.getAssociation(generatedShortQName); - if (customAssoc != null) - { - StringBuilder sb = new StringBuilder(); - sb.append("The association: '") - .append(customAssoc.getName()) - .append("' already exists."); - throw new AlfrescoRuntimeException(sb.toString()); - } - - M2ClassAssociation newAssoc; - - switch (type) - { - case BIDIRECTIONAL: - - newAssoc = customAssocsAspect.createAssociation(generatedShortQName); - break; - - case PARENTCHILD: - - newAssoc = customAssocsAspect.createChildAssociation(generatedShortQName); - break; - - default: - - StringBuilder sb = new StringBuilder(); - sb.append("Unsupported relationship type: '") - .append(type.toString()) - .append("'."); - throw new AlfrescoRuntimeException(sb.toString()); - } - - newAssoc.setSourceMandatory(false); - newAssoc.setTargetMandatory(false); - - // MOB-1573 - newAssoc.setSourceMany(true); - newAssoc.setTargetMany(true); - - newAssoc.setTitle(title); - newAssoc.setTargetClassName(RecordsManagementModel.ASPECT_RECORD.toPrefixString(getNamespaceService())); - writeCustomContentModel(modelRef, deserializedModel); - - return new RelationshipDefinitionImpl(relationshipDefinitionQName.getLocalName(), type, displayName); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.relationship.RelationshipService#updateReleationshipDefinition(java.lang.String) - */ - @Override - public RelationshipDefinition updateRelationshipDefinition(String uniqueName, RelationshipDisplayName displayName) - { - mandatoryString("uniqueName", uniqueName); - - RelationshipDefinition relationshipDefinition = getRelationshipDefinition(uniqueName); - if (relationshipDefinition == null) - { - StringBuilder sb = new StringBuilder(); - sb.append("The relationship definition for the unique name '") - .append(uniqueName) - .append("' was not found."); - throw new AlfrescoRuntimeException(sb.toString()); - } - - String title; - RelationshipType type = relationshipDefinition.getType(); - - switch (type) - { - case BIDIRECTIONAL: - - title = displayName.getSourceText(); - - if (isBlank(title)) - { - StringBuilder sb = new StringBuilder(); - sb.append("Label text '") - .append(title) - .append(" cannot be blank."); - throw new AlfrescoRuntimeException(sb.toString()); - } - - break; - - case PARENTCHILD: - - String sourceText = displayName.getSourceText(); - String targetText = displayName.getTargetText(); - - if (isBlank(sourceText) || isBlank(targetText)) - { - StringBuilder sb = new StringBuilder(); - sb.append("Neither source text '") - .append(sourceText) - .append("' nor target text '") - .append(targetText) - .append(" can be blank."); - throw new AlfrescoRuntimeException(sb.toString()); - } - - title = composeAssociationDefinitionTitle(sourceText, targetText); - - break; - - default: - - StringBuilder sb = new StringBuilder(); - sb.append("Unsupported relationship type: '") - .append(type.toString()) - .append("'."); - throw new AlfrescoRuntimeException(sb.toString()); - } - - if (existsTitle(title)) - { - StringBuilder sb = new StringBuilder(); - sb.append("Cannot update the relationship definition as '") - .append(title) - .append("' already exists."); - throw new AlfrescoRuntimeException(sb.toString()); - } - - QName associationDefinitionQName = getAssociationDefinitionName(uniqueName); - QName updatedAssociationDefinitionQName = persistUpdatedAssocTitle(associationDefinitionQName, title); - RelationshipDefinition updatedRelationshipDefinition = getRelationshipDefinition(updatedAssociationDefinitionQName.getLocalName()); - - if (updatedRelationshipDefinition == null) - { - throw new AlfrescoRuntimeException("The relationship definition could not be updated successfully."); - } - - return updatedRelationshipDefinition; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.relationship.RelationshipService#removeRelationshipDefinition(java.lang.String) - */ - @Override - public boolean removeRelationshipDefinition(String uniqueName) - { - mandatoryString("uniqueName", uniqueName); - - throw new UnsupportedOperationException("It is not possible to remove a relationship."); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.relationship.RelationshipService#existsRelationshipDefinition(java.lang.String) - */ - @Override - public boolean existsRelationshipDefinition(String uniqueName) - { - mandatoryString("uniqueName", uniqueName); - - boolean exists = false; - - RelationshipDefinition relationshipDefinition = getRelationshipDefinition(uniqueName); - if (relationshipDefinition != null) - { - exists = true; - } - - return exists; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.relationship.RelationshipService#getRelationshipsFrom(org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - public Set getRelationshipsFrom(NodeRef nodeRef) - { - mandatory("nodeRef", nodeRef); - - Set relationships = new HashSet(); - - List customReferencesFrom = getNodeService().getTargetAssocs(nodeRef, RegexQNamePattern.MATCH_ALL); - relationships.addAll(generateRelationshipFromAssociationRef(customReferencesFrom)); - - List customChildReferences = getNodeService().getChildAssocs(nodeRef); - relationships.addAll(generateRelationshipFromParentChildAssociationRef(customChildReferences)); - - return relationships; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.relationship.RelationshipService#getRelationshipsTo(org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - public Set getRelationshipsTo(NodeRef nodeRef) - { - mandatory("nodeRef", nodeRef); - - Set relationships = new HashSet(); - - List customReferencesTo = getNodeService().getSourceAssocs(nodeRef, RegexQNamePattern.MATCH_ALL); - relationships.addAll(generateRelationshipFromAssociationRef(customReferencesTo)); - - List customParentReferences = getNodeService().getParentAssocs(nodeRef); - relationships.addAll(generateRelationshipFromParentChildAssociationRef(customParentReferences)); - - return relationships; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.relationship.RelationshipService#addRelationship(java.lang.String, org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - public void addRelationship(String uniqueName, NodeRef source, NodeRef target) - { - mandatoryString("uniqueName", uniqueName); - mandatory("source", source); - mandatory("target", target); - - if (getNodeService().hasAspect(target, ASPECT_FROZEN)) - { - StringBuilder sb = new StringBuilder(); - sb.append("Relationship cannot be created as the target '"). - append(getNodeService().getProperty(target, ContentModel.PROP_NAME)). - append("' is in a hold."); - throw new AlfrescoRuntimeException(sb.toString()); - } - - // Check that the association definition for the given unique name exists. - AssociationDefinition associationDefinition = getAssociationDefinition(uniqueName); - if (associationDefinition == null) - { - StringBuilder sb = new StringBuilder(); - sb.append("No association definition found for '"). - append(uniqueName). - append("'."); - throw new IllegalArgumentException(sb.toString()); - } - - // Get the association definition name - QName associationDefinitionName = associationDefinition.getName(); - - // Check if an instance of this association already exists in the same direction - boolean associationAlreadyExists = associationExists(associationDefinition, source, target); - - if (associationAlreadyExists) - { - StringBuilder sb = new StringBuilder(); - sb.append("Association '"). - append(associationDefinitionName.getLocalName()). - append("' already exists from '"). - append(source). - append("' to '"). - append(target). - append("'."); - throw new AlfrescoRuntimeException(sb.toString()); - } - - // Invoke before create reference policy - invokeBeforeCreateReference(source, target, associationDefinitionName); - - if (associationDefinition.isChild()) - { - getNodeService().addChild(source, target, associationDefinitionName, associationDefinitionName); - } - else - { - getNodeService().createAssociation(source, target, associationDefinitionName); - } - - // Invoke on create reference policy - invokeOnCreateReference(source, target, associationDefinitionName); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.relationship.RelationshipService#removeRelationship(java.lang.String, org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - public void removeRelationship(String uniqueName, NodeRef source, NodeRef target) - { - mandatoryString("uniqueName", uniqueName); - mandatory("source", source); - mandatory("target", target); - - // Check that the association definition for the given unique name exists. - AssociationDefinition associationDefinition = getAssociationDefinition(uniqueName); - if (associationDefinition == null) - { - StringBuilder sb = new StringBuilder(); - sb.append("No association definition found for '"). - append(uniqueName). - append("'."); - throw new IllegalArgumentException(sb.toString()); - } - - // Get the association definition name - final QName associationDefinitionName = associationDefinition.getName(); - final NodeRef targetNode = target; - final NodeRef sourceNode = source; - - invokeBeforeRemoveReference(sourceNode, targetNode, associationDefinitionName); - - if (associationDefinition.isChild()) - { - AuthenticationUtil.runAsSystem(new RunAsWork() - { - @Override - public Void doWork() - { - List children = getNodeService().getChildAssocs(sourceNode); - for (ChildAssociationRef chRef : children) - { - if (associationDefinitionName.equals(chRef.getTypeQName()) && chRef.getChildRef().equals(targetNode)) - { - getNodeService().removeChildAssociation(chRef); - } - } - - return null; - } - }); - } - else - { - getNodeService().removeAssociation(source, targetNode, associationDefinitionName); - } - - invokeOnRemoveReference(source, targetNode, associationDefinitionName); - } - - /** - * Creates the relationship definition from the association definition - * - * @param associationDefinition The association definition - * @return The relationship definition if associationDefinition exists, null otherwise - */ - private RelationshipDefinition createRelationshipDefinition(AssociationDefinition associationDefinition) - { - RelationshipDefinition relationshipDefinition = null; - - if (associationDefinition != null) - { - String uniqueName = associationDefinition.getName().getLocalName(); - - RelationshipType type = getRelationshipType(associationDefinition); - - String title = associationDefinition.getTitle(getDictionaryService()); - RelationshipDisplayName displayName = getRelationshipDisplayName(type, title); - - relationshipDefinition = new RelationshipDefinitionImpl(uniqueName, type, displayName); - } - - return relationshipDefinition; - } - - /** - * Gets the relationship type from the association definition - * - * @param associationDefinition The association definition - * @return The type of the relationship definition - */ - private RelationshipType getRelationshipType(AssociationDefinition associationDefinition) - { - RelationshipType type; - - if (associationDefinition instanceof ChildAssociationDefinition) - { - type = RelationshipType.PARENTCHILD; - } - else - { - type = RelationshipType.BIDIRECTIONAL; - } - - return type; - } - - /** - * Gets the relationship display name of the relationship definition - * - * @param type The type of the relationship definition - * @param title The title of the association definition - * @return The relationship display name of the relationship definition - */ - private RelationshipDisplayName getRelationshipDisplayName(RelationshipType type, String title) - { - String sourceText = null; - String targetText = null; - - switch (type) - { - case BIDIRECTIONAL: - - sourceText = title; - targetText = title; - break; - - case PARENTCHILD: - - String[] sourceAndTarget = splitAssociationDefinitionTitle(title); - sourceText = sourceAndTarget[0]; - targetText = sourceAndTarget[1]; - break; - - default: - - StringBuilder sb = new StringBuilder(); - sb.append("Unsupported relationship type: '") - .append(type.toString()) - .append("'."); - throw new AlfrescoRuntimeException(sb.toString()); - } - - return new RelationshipDisplayName(sourceText, targetText); - } - - /** - * Generates relationships from the given association references - * - * @param associationRefs Association references - * @return Relationships generated from the given association references - */ - private Set generateRelationshipFromAssociationRef(List associationRefs) - { - Set relationships = new HashSet(); - - for (AssociationRef associationRef : associationRefs) - { - String uniqueName = associationRef.getTypeQName().getLocalName(); - if (existsRelationshipDefinition(uniqueName)) - { - NodeRef from = associationRef.getSourceRef(); - NodeRef to = associationRef.getTargetRef(); - relationships.add(new RelationshipImpl(uniqueName, from, to)); - } - } - - return relationships; - } - - /** - * Generates relationships from the given child association references - * - * @param childAssociationRefs Child association references - * @return Relationships generated from the given child association references - */ - private Set generateRelationshipFromParentChildAssociationRef(List childAssociationRefs) - { - Set relationships = new HashSet(); - - for (ChildAssociationRef childAssociationRef : childAssociationRefs) - { - String uniqueName = childAssociationRef.getQName().getLocalName(); - if (existsRelationshipDefinition(uniqueName)) - { - NodeRef from = childAssociationRef.getParentRef(); - NodeRef to = childAssociationRef.getChildRef(); - relationships.add(new RelationshipImpl(uniqueName, from, to)); - } - } - - return relationships; - } - - /** - * Determines the relationship type from the display name - * - * @param displayName The display name of the relationship - * @return The relationship type from the display name - */ - private RelationshipType determineRelationshipTypeFromDisplayName(RelationshipDisplayName displayName) - { - RelationshipType relationshipType; - - String sourceText = displayName.getSourceText(); - String targetText = displayName.getTargetText(); - - String errorMsg = "Relationship type could not be determined from the display name. It is neither biderectional nor parent/child relationship"; - - if (isBlank(sourceText) || isBlank(targetText)) - { - throw new AlfrescoRuntimeException(errorMsg); - } - - if (sourceText.equals(targetText)) - { - relationshipType = RelationshipType.BIDIRECTIONAL; - } - else - { - relationshipType = RelationshipType.PARENTCHILD; - } - - return relationshipType; - } - - /** - * Invoke before create reference policy - * - * @param source The source node reference - * @param target The target node reference - * @param associationDefinitionName The association definition name - */ - private void invokeBeforeCreateReference(NodeRef source, NodeRef target, QName associationDefinitionName) - { - // Get QNames to invoke against - Set qnames = PoliciesUtil.getTypeAndAspectQNames(getNodeService(), source); - // Execute policy for node type and aspects - BeforeCreateReference policy = beforeCreateReferenceDelegate.get(qnames); - policy.beforeCreateReference(source, target, associationDefinitionName); - } - - /** - * Invoke on create reference policy - * - * @param source The source node reference - * @param target The target node reference - * @param associationDefinitionName The association definition name - */ - private void invokeOnCreateReference(NodeRef source, NodeRef target, QName associationDefinitionName) - { - // Get QNames to invoke against - Set qnames = PoliciesUtil.getTypeAndAspectQNames(getNodeService(), source); - // Execute policy for node type and aspects - OnCreateReference policy = onCreateReferenceDelegate.get(qnames); - policy.onCreateReference(source, target, associationDefinitionName); - } - - /** - * Invoke before remove reference policy - * - * @param source The source node reference - * @param target The target node reference - * @param associationDefinitionName The association definition name - */ - private void invokeBeforeRemoveReference(NodeRef source, NodeRef target, QName associationDefinitionName) - { - // Get QNames to invoke against - Set qnames = PoliciesUtil.getTypeAndAspectQNames(getNodeService(), source); - // Execute policy for node type and aspects - BeforeRemoveReference policy = beforeRemoveReferenceDelegate.get(qnames); - policy.beforeRemoveReference(source, target, associationDefinitionName); - } - - /** - * Invoke on remove reference policy - * - * @param source The source node reference - * @param target The target node reference - * @param associationDefinitionName The association definition name - */ - private void invokeOnRemoveReference(NodeRef source, NodeRef target, QName associationDefinitionName) - { - // Get QNames to invoke against - Set qnames = PoliciesUtil.getTypeAndAspectQNames(getNodeService(), source); - // Execute policy for node type and aspects - OnRemoveReference policy = onRemoveReferenceDelegate.get(qnames); - policy.onRemoveReference(source, target, associationDefinitionName); - } - - /** - * Check if an instance of the association already exists from the given - * source node reference to the given target node reference - * - * @param associationDefinition The association definition - * @param source The source node reference - * @param target The target node reference - * @return true if an association already exists, false otherwise - */ - private boolean associationExists(AssociationDefinition associationDefinition, NodeRef source, NodeRef target) - { - boolean associationAlreadyExists = false; - - QName associationDefinitionName = associationDefinition.getName(); - if (associationDefinition.isChild()) - { - List childAssocs = getNodeService().getChildAssocs(source, associationDefinitionName, associationDefinitionName); - for (ChildAssociationRef chAssRef : childAssocs) - { - if (chAssRef.getChildRef().equals(target)) - { - associationAlreadyExists = true; - } - } - } - else - { - List assocs = getNodeService().getTargetAssocs(source, associationDefinitionName); - for (AssociationRef assRef : assocs) - { - if (assRef.getTargetRef().equals(target)) - { - associationAlreadyExists = true; - } - } - } - - return associationAlreadyExists; - } - - /** - * Gets the association definition for the given unique name - * - * @param uniqueName The unique name - * @return The association definition for the given unique name if exists, null otherwise - */ - private AssociationDefinition getAssociationDefinition(String uniqueName) - { - AssociationDefinition associationDefinition = null; - - Set> associationsEntrySet = getCustomAssociations().entrySet(); - for (Map.Entry associationEntry : associationsEntrySet) - { - String localName = associationEntry.getKey().getLocalName(); - if (uniqueName.equals(localName)) - { - associationDefinition = associationEntry.getValue(); - break; - } - } - - return associationDefinition; - } - - /** - * Gets the qualified name of the association definition for the given unique name - * - * @param uniqueName The unique name - * @return The qualified name of the association definition for the given unique name - */ - private QName getAssociationDefinitionName(String uniqueName) - { - AssociationDefinition associationDefinition = getAssociationDefinition(uniqueName); - - if (associationDefinition == null) - { - StringBuilder sb = new StringBuilder(); - sb.append("The qualified name for '") - .append(uniqueName) - .append("' was not found."); - throw new AlfrescoRuntimeException(sb.toString()); - } - - return associationDefinition.getName(); - } - - /** - * This method writes the specified String into the association's title property. - * For RM custom properties and references, Title is used to store the identifier. - * - * NOTE: Currently RMC custom associations only - * @param associationDefinitionQName Qualified name for the association definition - * @param newTitle The new title - * @return Qualified name for the association definition - */ - private QName persistUpdatedAssocTitle(QName associationDefinitionQName, String newTitle) - { - mandatory("associationDefinitionQName", associationDefinitionQName); - - AssociationDefinition assocDefn = getDictionaryService().getAssociation(associationDefinitionQName); - if (assocDefn == null) - { - StringBuilder sb = new StringBuilder(); - sb.append("Cannot find the association definiton for '"). - append(associationDefinitionQName.getLocalName()). - append("'."); - throw new AlfrescoRuntimeException(sb.toString()); - } - - // defaults to RM_CUSTOM_URI - NodeRef modelRef = getCustomModelRef(""); - M2Model deserializedModel = readCustomContentModel(modelRef); - - String customAspectName = ASPECT_CUSTOM_ASSOCIATIONS.toPrefixString(getNamespaceService()); - M2Aspect customAssocsAspect = deserializedModel.getAspect(customAspectName); - - for (M2ClassAssociation assoc : customAssocsAspect.getAssociations()) - { - if (associationDefinitionQName.toPrefixString(getNamespaceService()).equals(assoc.getName()) && newTitle != null) - { - assoc.setTitle(newTitle); - } - } - writeCustomContentModel(modelRef, deserializedModel); - - if (logger.isInfoEnabled()) - { - logger.info("persistUpdatedAssocTitle: " + associationDefinitionQName + "=" + newTitle + " to aspect: " + customAspectName); - } - - return associationDefinitionQName; - } - - /** - * Generates a qualified name for the given relationship definition unique name - * - * @param uniqueName The unique name of the relationship definition - * @return The qualified name of relationship definition - */ - private QName generateRelationshipDefinitionQNameFor(String uniqueName) - { - mandatoryString("uniqueName", uniqueName); - - QName existingQName = null; - - Set customAssociationsQNames = getCustomAssociations().keySet(); - for (QName customAssociationsQName : customAssociationsQNames) - { - if (uniqueName.equals(customAssociationsQName.getLocalName())) - { - existingQName = customAssociationsQName; - } - } - - if (existingQName != null) - { - StringBuilder sb = new StringBuilder(); - sb.append("Cannot create qualified name for given unique name '"). - append(uniqueName). - append("' as it already exists."); - throw new AlfrescoRuntimeException(sb.toString()); - } - - return QName.createQName(RM_CUSTOM_PREFIX, GUID.generate(), getNamespaceService()); - } -} diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/relationship/RelationshipType.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/relationship/RelationshipType.java deleted file mode 100644 index acc78cc977..0000000000 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/relationship/RelationshipType.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright (C) 2005-2014 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - */ -package org.alfresco.module.org_alfresco_module_rm.relationship; - -/** - * Enum representing the relationship types - * - * @author Tuna Aksoy - * @since 2.3 - */ -public enum RelationshipType -{ - BIDIRECTIONAL, - PARENTCHILD; -} diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/role/FilePlanRoleServiceImpl.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/role/FilePlanRoleServiceImpl.java index b9c65bcf43..89193d0def 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/role/FilePlanRoleServiceImpl.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/role/FilePlanRoleServiceImpl.java @@ -68,7 +68,7 @@ public class FilePlanRoleServiceImpl implements FilePlanRoleService, /** Location of bootstrap role JSON */ private static final String BOOTSTRAP_ROLE_JSON_LOCATION = "alfresco/module/org_alfresco_module_rm/security/rm-default-roles-bootstrap.json"; - + /** JSON names */ private static final String JSON_NAME = "name"; private static final String JSON_DISPLAY_LABEL = "displayLabel"; @@ -242,7 +242,7 @@ public class FilePlanRoleServiceImpl implements FilePlanRoleService, /** * Bootstraps the default roles - * + * * @param filePlan file plan * @param systemContainers system containers */ @@ -327,7 +327,7 @@ public class FilePlanRoleServiceImpl implements FilePlanRoleService, // Add any additional admin permissions if (isAdmin) - { + { // Admin has filing permissionService.setPermission(filePlan, role.getRoleGroupName(), RMPermissionModel.FILING, true); if (systemContainers != null) diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/script/AbstractRmWebScript.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/script/AbstractRmWebScript.java index 9a6704959d..5f93f6e615 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/script/AbstractRmWebScript.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/script/AbstractRmWebScript.java @@ -18,8 +18,7 @@ */ package org.alfresco.module.org_alfresco_module_rm.script; -import static org.alfresco.util.WebScriptUtils.getTemplateVars; - +import java.util.List; import java.util.Map; import javax.servlet.http.HttpServletResponse; @@ -27,96 +26,23 @@ import javax.servlet.http.HttpServletResponse; import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionService; import org.alfresco.service.cmr.repository.NodeRef; import org.alfresco.service.cmr.repository.NodeService; +import org.alfresco.service.cmr.repository.StoreRef; import org.alfresco.service.namespace.NamespaceService; +import org.json.JSONObject; import org.springframework.extensions.webscripts.DeclarativeWebScript; +import org.springframework.extensions.webscripts.Status; import org.springframework.extensions.webscripts.WebScriptException; import org.springframework.extensions.webscripts.WebScriptRequest; /** - * Abstract base class for all RM webscript classes. - * Includes utility methods for processing the webscript request. * * @author Neil McErlean - * @author Tuna Aksoy */ public abstract class AbstractRmWebScript extends DeclarativeWebScript { - /** Constants */ - protected static final String PATH_SEPARATOR = "/"; - protected static final String STORE_TYPE = "store_type"; - protected static final String STORE_ID = "store_id"; - protected static final String ID = "id"; - protected static final String SUCCESS = "success"; - protected static final String INVERT = "__invert"; - - /** Disposition service */ - private DispositionService dispositionService; - - /** Namespace service */ - private NamespaceService namespaceService; - - /** Node service */ - private NodeService nodeService; - - /** - * Gets the disposition service instance - * - * @return The disposition service instance - */ - protected DispositionService getDispositionService() - { - return this.dispositionService; - } - - /** - * Sets the disposition service instance - * - * @param dispositionService The disposition service instance - */ - public void setDispositionService(DispositionService dispositionService) - { - this.dispositionService = dispositionService; - } - - /** - * Gets the namespace service instance - * - * @return The namespace service instance - */ - protected NamespaceService getNamespaceService() - { - return this.namespaceService; - } - - /** - * Sets the namespace service instance - * - * @param namespaceService The namespace service instance - */ - public void setNamespaceService(NamespaceService namespaceService) - { - this.namespaceService = namespaceService; - } - - /** - * Gets the node service instance - * - * @return The node service instance - */ - protected NodeService getNodeService() - { - return this.nodeService; - } - - /** - * Sets the node service instance - * - * @param nodeService The node service instance - */ - public void setNodeService(NodeService nodeService) - { - this.nodeService = nodeService; - } + protected NodeService nodeService; + protected DispositionService dispositionService; + protected NamespaceService namespaceService; /** * Parses the request and providing it's valid returns the NodeRef. @@ -130,20 +56,80 @@ public abstract class AbstractRmWebScript extends DeclarativeWebScript { // get the parameters that represent the NodeRef, we know they are present // otherwise this webscript would not have matched - Map templateVars = getTemplateVars(req); - String storeType = templateVars.get(STORE_TYPE); - String storeId = templateVars.get(STORE_ID); - String nodeId = templateVars.get(ID); + Map templateVars = req.getServiceMatch().getTemplateVars(); + String storeType = templateVars.get("store_type"); + String storeId = templateVars.get("store_id"); + String nodeId = templateVars.get("id"); // create the NodeRef and ensure it is valid - NodeRef nodeRef = new NodeRef(storeType, storeId, nodeId); + StoreRef storeRef = new StoreRef(storeType, storeId); + NodeRef nodeRef = new NodeRef(storeRef, nodeId); - if (!getNodeService().exists(nodeRef)) + if (!this.nodeService.exists(nodeRef)) { - throw new WebScriptException(HttpServletResponse.SC_NOT_FOUND, "Unable to find node: '" + - nodeRef.toString() + "'."); + throw new WebScriptException(HttpServletResponse.SC_NOT_FOUND, "Unable to find node: " + + nodeRef.toString()); } return nodeRef; } + + /** + * @param dispositionService the disposition serviceS + */ + public void setDispositionService(DispositionService dispositionService) + { + this.dispositionService = dispositionService; + } + + /** + * Sets the NodeService instance + * + * @param nodeService The NodeService instance + */ + public void setNodeService(NodeService nodeService) + { + this.nodeService = nodeService; + } + + /** + * Sets the NamespaceService instance + * + * @param namespaceService The NamespaceService instance + */ + public void setNamespaceService(NamespaceService namespaceService) + { + this.namespaceService = namespaceService; + } + + /** + * This method checks if the json object contains an entry with the specified name. + * + * @param json the json object. + * @param paramName the name to check for. + * @throws WebScriptException if the specified entry is missing. + */ + protected void checkMandatoryJsonParam(JSONObject json, String paramName) + { + if (!json.has(paramName)) + { + throw new WebScriptException(Status.STATUS_BAD_REQUEST, + "Mandatory '" + paramName + "' parameter was not provided in request body"); + } + } + + /** + * This method checks if the json object contains entries with the specified names. + * + * @param json the json object. + * @param paramNames the names to check for. + * @throws WebScriptException if any of the specified entries are missing. + */ + protected void checkMandatoryJsonParams(JSONObject json, List paramNames) + { + for (String name : paramNames) + { + this.checkMandatoryJsonParam(json, name); + } + } } \ No newline at end of file diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/script/ApplyDodCertModelFixesGet.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/script/ApplyDodCertModelFixesGet.java index 754248276a..1a518d72c3 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/script/ApplyDodCertModelFixesGet.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/script/ApplyDodCertModelFixesGet.java @@ -29,6 +29,7 @@ import java.util.Map; import org.alfresco.error.AlfrescoRuntimeException; import org.alfresco.model.ContentModel; +import org.alfresco.module.org_alfresco_module_rm.admin.RecordsManagementAdminServiceImpl; import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementCustomModel; import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; import org.alfresco.repo.content.MimetypeMap; @@ -41,7 +42,6 @@ import org.alfresco.service.cmr.repository.ContentReader; import org.alfresco.service.cmr.repository.ContentService; import org.alfresco.service.cmr.repository.ContentWriter; import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.namespace.NamespaceService; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.springframework.extensions.webscripts.Cache; @@ -75,18 +75,12 @@ public class ApplyDodCertModelFixesGet extends DeclarativeWebScript private static Log logger = LogFactory.getLog(ApplyDodCertModelFixesGet.class); private ContentService contentService; - private NamespaceService namespaceService; public void setContentService(ContentService contentService) { this.contentService = contentService; } - public void setNamespaceService(NamespaceService namespaceService) - { - this.namespaceService = namespaceService; - } - @Override public Map executeImpl(WebScriptRequest req, Status status, Cache cache) { @@ -97,12 +91,11 @@ public class ApplyDodCertModelFixesGet extends DeclarativeWebScript M2Model customModel = readCustomContentModel(); - String customAspectName = ASPECT_CUSTOM_ASSOCIATIONS.toPrefixString(namespaceService); - M2Aspect customAssocsAspect = customModel.getAspect(customAspectName); + M2Aspect customAssocsAspect = customModel.getAspect(RecordsManagementAdminServiceImpl.RMC_CUSTOM_ASSOCS); if (customAssocsAspect == null) { - final String msg = "Unknown aspect: " + customAspectName; + final String msg = "Unknown aspect: " + RecordsManagementAdminServiceImpl.RMC_CUSTOM_ASSOCS; if (logger.isErrorEnabled()) { logger.error(msg); @@ -124,6 +117,8 @@ public class ApplyDodCertModelFixesGet extends DeclarativeWebScript } + + //MOB-1621. Custom fields should be created as untokenized by default. if (logger.isInfoEnabled()) { diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/script/ApplyFixMob1573Get.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/script/ApplyFixMob1573Get.java index df46460489..a0378ed758 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/script/ApplyFixMob1573Get.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/script/ApplyFixMob1573Get.java @@ -27,6 +27,7 @@ import java.util.Map; import org.alfresco.error.AlfrescoRuntimeException; import org.alfresco.model.ContentModel; +import org.alfresco.module.org_alfresco_module_rm.admin.RecordsManagementAdminServiceImpl; import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; import org.alfresco.repo.content.MimetypeMap; import org.alfresco.repo.dictionary.M2Aspect; @@ -36,7 +37,6 @@ import org.alfresco.service.cmr.repository.ContentReader; import org.alfresco.service.cmr.repository.ContentService; import org.alfresco.service.cmr.repository.ContentWriter; import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.namespace.NamespaceService; import org.springframework.extensions.webscripts.Cache; import org.springframework.extensions.webscripts.DeclarativeWebScript; import org.springframework.extensions.webscripts.Status; @@ -58,18 +58,12 @@ public class ApplyFixMob1573Get extends DeclarativeWebScript private static final NodeRef RM_CUSTOM_MODEL_NODE_REF = new NodeRef("workspace://SpacesStore/records_management_custom_model"); private ContentService contentService; - private NamespaceService namespaceService; public void setContentService(ContentService contentService) { this.contentService = contentService; } - public void setNamespaceService(NamespaceService namespaceService) - { - this.namespaceService = namespaceService; - } - @Override public Map executeImpl(WebScriptRequest req, Status status, Cache cache) { @@ -77,7 +71,7 @@ public class ApplyFixMob1573Get extends DeclarativeWebScript // Go through every custom reference defined in the custom model and make sure that it // has many-to-many multiplicity - String aspectName = ASPECT_CUSTOM_ASSOCIATIONS.toPrefixString(namespaceService); + String aspectName = RecordsManagementAdminServiceImpl.RMC_CUSTOM_ASSOCS; M2Aspect customAssocsAspect = customModel.getAspect(aspectName); if (customAssocsAspect == null) @@ -101,7 +95,7 @@ public class ApplyFixMob1573Get extends DeclarativeWebScript private M2Model readCustomContentModel() { - ContentReader reader = contentService.getReader(RM_CUSTOM_MODEL_NODE_REF, + ContentReader reader = this.contentService.getReader(RM_CUSTOM_MODEL_NODE_REF, ContentModel.TYPE_CONTENT); if (!reader.exists()) {throw new AlfrescoRuntimeException("RM CustomModel has no content.");} @@ -124,7 +118,7 @@ public class ApplyFixMob1573Get extends DeclarativeWebScript } catch (IOException ignored) { - // Intentionally empty. + // Intentionally empty.` } } return deserializedModel; @@ -132,7 +126,7 @@ public class ApplyFixMob1573Get extends DeclarativeWebScript private void writeCustomContentModel(M2Model deserializedModel) { - ContentWriter writer = contentService.getWriter(RM_CUSTOM_MODEL_NODE_REF, + ContentWriter writer = this.contentService.getWriter(RM_CUSTOM_MODEL_NODE_REF, ContentModel.TYPE_CONTENT, true); writer.setMimetype(MimetypeMap.MIMETYPE_XML); writer.setEncoding("UTF-8"); diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/script/BaseCustomPropertyWebScript.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/script/BaseCustomPropertyWebScript.java index 0463060cb8..cd501c6083 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/script/BaseCustomPropertyWebScript.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/script/BaseCustomPropertyWebScript.java @@ -58,7 +58,7 @@ public class BaseCustomPropertyWebScript extends AbstractRmWebScript else { // Try and convert the string to a qname - return QName.createQName(elementName, getNamespaceService()); + return QName.createQName(elementName, namespaceService); } } } \ No newline at end of file diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/script/BootstrapTestDataGet.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/script/BootstrapTestDataGet.java index 9524c4bbdc..ed9c05763a 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/script/BootstrapTestDataGet.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/script/BootstrapTestDataGet.java @@ -276,7 +276,7 @@ public class BootstrapTestDataGet extends DeclarativeWebScript } // Make sure all the containers do not inherit permissions - ResultSet rs = searchService.query(SPACES_STORE, SearchService.LANGUAGE_FTS_ALFRESCO, "TYPE:\"rma:recordsManagementContainer\""); + ResultSet rs = searchService.query(SPACES_STORE, SearchService.LANGUAGE_LUCENE, "TYPE:\"rma:recordsManagementContainer\""); try { logger.info("Bootstraping " + rs.length() + " record containers ..."); @@ -299,7 +299,7 @@ public class BootstrapTestDataGet extends DeclarativeWebScript } // fix up the test dataset to fire initial events for disposition schedules - rs = searchService.query(SPACES_STORE, SearchService.LANGUAGE_FTS_ALFRESCO, "TYPE:\"rma:recordFolder\""); + rs = searchService.query(SPACES_STORE, SearchService.LANGUAGE_LUCENE, "TYPE:\"rma:recordFolder\""); try { logger.info("Bootstraping " + rs.length() + " record folders ..."); diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/script/CustomPropertyDefinitionDelete.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/script/CustomPropertyDefinitionDelete.java index df9754b380..2dacf7910c 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/script/CustomPropertyDefinitionDelete.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/script/CustomPropertyDefinitionDelete.java @@ -106,7 +106,7 @@ public class CustomPropertyDefinitionDelete extends AbstractRmWebScript rmAdminService.removeCustomPropertyDefinition(propQName); - result.put("propertyqname", propQName.toPrefixString(getNamespaceService())); + result.put("propertyqname", propQName.toPrefixString(namespaceService)); return result; } diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/script/CustomPropertyDefinitionPost.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/script/CustomPropertyDefinitionPost.java index 97ef604047..1d9d10b735 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/script/CustomPropertyDefinitionPost.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/script/CustomPropertyDefinitionPost.java @@ -41,7 +41,7 @@ import org.springframework.extensions.webscripts.WebScriptRequest; /** * Implementation for Java backed webscript to add RM custom property definitions * to the custom model. - * + * * @author Neil McErlean */ public class CustomPropertyDefinitionPost extends BaseCustomPropertyWebScript @@ -101,22 +101,22 @@ public class CustomPropertyDefinitionPost extends BaseCustomPropertyWebScript /** * Applies custom properties. - * @throws CustomMetadataException + * @throws CustomMetadataException */ protected Map createPropertyDefinition(WebScriptRequest req, JSONObject json) throws JSONException, CustomMetadataException { Map result = new HashMap(); Map params = getParamsFromUrlAndJson(req, json); - + QName propertyQName = createNewPropertyDefinition(params); String localName = propertyQName.getLocalName(); - + result.put(PROP_ID, localName); - + String urlResult = req.getServicePath() + "/" + propertyQName.getLocalName(); result.put(URL, urlResult); - + return result; } @@ -127,33 +127,33 @@ public class CustomPropertyDefinitionPost extends BaseCustomPropertyWebScript Map params; params = new HashMap(); params.put(PARAM_ELEMENT, req.getParameter(PARAM_ELEMENT)); - + for (Iterator iter = json.keys(); iter.hasNext(); ) { String nextKeyString = (String)iter.next(); String nextValueString = json.getString(nextKeyString); - + params.put(nextKeyString, nextValueString); } - + return params; } /** * Create a property definition based on the parameter values provided - * + * * @param params parameter values * @return {@link QName} qname of the newly created custom property - * @throws CustomMetadataException + * @throws CustomMetadataException */ protected QName createNewPropertyDefinition(Map params) throws CustomMetadataException { - // Get the customisable type name + // Get the customisable type name String customisableElement = (String)params.get(PARAM_ELEMENT); QName customisableType = mapToTypeQName(customisableElement); - + String label = URLDecoder.decode((String)params.get(PARAM_LABEL)); - + //According to the wireframes, type here can only be date|text|number Serializable serializableParam = params.get(PARAM_DATATYPE); QName type = null; @@ -161,7 +161,7 @@ public class CustomPropertyDefinitionPost extends BaseCustomPropertyWebScript { if (serializableParam instanceof String) { - type = QName.createQName((String)serializableParam, getNamespaceService()); + type = QName.createQName((String)serializableParam, namespaceService); } else if (serializableParam instanceof QName) { @@ -172,41 +172,41 @@ public class CustomPropertyDefinitionPost extends BaseCustomPropertyWebScript throw new AlfrescoRuntimeException("Unexpected type of dataType param: "+serializableParam+" (expected String or QName)"); } } - + // The title is actually generated, so this parameter will be ignored // by the RMAdminService String title = (String)params.get(PARAM_TITLE); String description = (String)params.get(PARAM_DESCRIPTION); String defaultValue = (String)params.get(PARAM_DEFAULT_VALUE); - + boolean mandatory = false; serializableParam = params.get(PARAM_MANDATORY); if (serializableParam != null) { mandatory = Boolean.valueOf(serializableParam.toString()); } - + boolean isProtected = false; serializableParam = params.get(PARAM_PROTECTED); if (serializableParam != null) { isProtected = Boolean.valueOf(serializableParam.toString()); } - + boolean multiValued = false; serializableParam = params.get(PARAM_MULTI_VALUED); if (serializableParam != null) { multiValued = Boolean.valueOf(serializableParam.toString()); } - + serializableParam = params.get(PARAM_CONSTRAINT_REF); QName constraintRef = null; if (serializableParam != null) { if (serializableParam instanceof String) { - constraintRef = QName.createQName((String)serializableParam, getNamespaceService()); + constraintRef = QName.createQName((String)serializableParam, namespaceService); } else if (serializableParam instanceof QName) { @@ -217,29 +217,29 @@ public class CustomPropertyDefinitionPost extends BaseCustomPropertyWebScript throw new AlfrescoRuntimeException("Unexpected type of constraintRef param: "+serializableParam+" (expected String or QName)"); } } - + // if propId is specified, use it. QName proposedQName = null; String propId = (String)params.get(PROP_ID); if (propId != null) { - proposedQName = QName.createQName(RecordsManagementCustomModel.RM_CUSTOM_PREFIX, propId, getNamespaceService()); + proposedQName = QName.createQName(RecordsManagementCustomModel.RM_CUSTOM_PREFIX, propId, namespaceService); } - + return rmAdminService.addCustomPropertyDefinition( - proposedQName, - customisableType, - label, + proposedQName, + customisableType, + label, type, - title, - description, - defaultValue, - multiValued, - mandatory, - isProtected, + title, + description, + defaultValue, + multiValued, + mandatory, + isProtected, constraintRef); } - - - + + + } \ No newline at end of file diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/script/CustomPropertyDefinitionPut.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/script/CustomPropertyDefinitionPut.java index 5f37381f55..25722e80a8 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/script/CustomPropertyDefinitionPut.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/script/CustomPropertyDefinitionPut.java @@ -164,7 +164,7 @@ public class CustomPropertyDefinitionPut extends BaseCustomPropertyWebScript } if (!exists) { - QName constraintRefQName = QName.createQName(constraintRef, getNamespaceService()); + QName constraintRefQName = QName.createQName(constraintRef, namespaceService); result = rmAdminService.setCustomPropertyDefinitionConstraint(propQName, constraintRefQName); updated = true; } @@ -182,7 +182,7 @@ public class CustomPropertyDefinitionPut extends BaseCustomPropertyWebScript { if (!updated) { - String propIdAsString = rmAdminService.getQNameForClientId(label).toPrefixString(getNamespaceService()); + String propIdAsString = rmAdminService.getQNameForClientId(label).toPrefixString(namespaceService); throw new PropertyAlreadyExistsMetadataException(propIdAsString); } } diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/script/CustomRefDelete.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/script/CustomRefDelete.java index f4fc9d8a69..2a700b1f85 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/script/CustomRefDelete.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/script/CustomRefDelete.java @@ -18,135 +18,124 @@ */ package org.alfresco.module.org_alfresco_module_rm.script; -import static org.alfresco.util.WebScriptUtils.getRequestParameterValue; - import java.util.HashMap; import java.util.Map; -import org.alfresco.module.org_alfresco_module_rm.relationship.RelationshipService; +import javax.servlet.http.HttpServletResponse; + +import org.alfresco.module.org_alfresco_module_rm.admin.RecordsManagementAdminService; import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.cmr.repository.StoreRef; import org.alfresco.service.cmr.rule.RuleService; import org.alfresco.service.cmr.rule.RuleType; +import org.alfresco.service.namespace.QName; import org.springframework.extensions.webscripts.Cache; import org.springframework.extensions.webscripts.Status; import org.springframework.extensions.webscripts.WebScriptException; import org.springframework.extensions.webscripts.WebScriptRequest; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; /** - * Implementation for Java backed webscript to remove RM custom relationship from a node. + * Implementation for Java backed webscript to remove RM custom reference instances + * from a node. * * @author Neil McErlean - * @author Tuna Aksoy */ public class CustomRefDelete extends AbstractRmWebScript { - /** Constants */ - private static final String REF_ID = "refId"; - private static final String ST = "st"; - private static final String SI = "si"; + /** Logger */ + private static Log logger = LogFactory.getLog(CustomRefDelete.class); - /** Relationship service */ - private RelationshipService relationshipService; + /** RM Admin Service */ + private RecordsManagementAdminService rmAdminService; - /** Rule service */ + /** Rule Service */ private RuleService ruleService; /** - * Gets the relationship service instance - * - * @return The relationship service instance + * @param rmAdminService RM Admin Service */ - protected RelationshipService getRelationshipService() + public void setRecordsManagementAdminService(RecordsManagementAdminService rmAdminService) { - return this.relationshipService; - } + this.rmAdminService = rmAdminService; + } /** - * Sets the relationship service instance - * - * @param relationshipService The relationship service instance - */ - public void setRelationshipService(RelationshipService relationshipService) - { - this.relationshipService = relationshipService; - } - - /** - * Returns the rule service instance - * - * @return The rule service instance - */ - protected RuleService getRuleService() - { - return this.ruleService; - } - - /** - * Sets the rule service instance - * - * @param ruleService The rule service instance + * @param ruleService Rule Service */ public void setRuleService(RuleService ruleService) { this.ruleService = ruleService; } - /** - * @see org.springframework.extensions.webscripts.DeclarativeWebScript#executeImpl(org.springframework.extensions.webscripts.WebScriptRequest, - * org.springframework.extensions.webscripts.Status, - * org.springframework.extensions.webscripts.Cache) + /* + * @see org.alfresco.web.scripts.DeclarativeWebScript#executeImpl(org.alfresco.web.scripts.WebScriptRequest, org.alfresco.web.scripts.Status, org.alfresco.web.scripts.Cache) */ @Override protected Map executeImpl(WebScriptRequest req, Status status, Cache cache) { - Map model = new HashMap(1); + Map ftlModel; + ruleService.disableRuleType(RuleType.OUTBOUND); + try { - getRuleService().disableRuleType(RuleType.OUTBOUND); - removeCustomRelationship(req); - model.put(SUCCESS, true); + ftlModel = removeCustomReferenceInstance(req); } finally { - getRuleService().enableRuleType(RuleType.OUTBOUND); + ruleService.enableRuleType(RuleType.OUTBOUND); } - return model; + + return ftlModel; } /** - * Removes a custom relationship - * - * @param req The webscript request + * Removes custom reference. */ - private void removeCustomRelationship(WebScriptRequest req) + protected Map removeCustomReferenceInstance(WebScriptRequest req) { - String uniqueName = getRequestParameterValue(req, REF_ID); - NodeRef source = parseRequestForNodeRef(req); - NodeRef target = getTargetNode(req); + NodeRef fromNodeRef = parseRequestForNodeRef(req); - getRelationshipService().removeRelationship(uniqueName, source, target); - getRelationshipService().removeRelationship(uniqueName, target, source); - } + // Get the toNode from the URL query string. + String storeType = req.getParameter("st"); + String storeId = req.getParameter("si"); + String nodeId = req.getParameter("id"); - /** - * Gets the target node - * - * @param req The webscript request - * @return The target node - */ - private NodeRef getTargetNode(WebScriptRequest req) - { - String storeType = req.getParameter(ST); - String storeId = req.getParameter(SI); - String nodeId = req.getParameter(ID); + // create the NodeRef and ensure it is valid + StoreRef storeRef = new StoreRef(storeType, storeId); + NodeRef toNodeRef = new NodeRef(storeRef, nodeId); - NodeRef targetNode = new NodeRef(storeType, storeId, nodeId); - if (!getNodeService().exists(targetNode)) + if (!this.nodeService.exists(toNodeRef)) { - throw new WebScriptException(Status.STATUS_NOT_FOUND, "Unable to find the target node: '" + - targetNode.toString() + "'."); + throw new WebScriptException(HttpServletResponse.SC_NOT_FOUND, "Unable to find to-node: " + + toNodeRef.toString()); } - return targetNode; + Map result = new HashMap(); + + Map templateVars = req.getServiceMatch().getTemplateVars(); + String clientsRefId = templateVars.get("refId"); + QName qn = rmAdminService.getQNameForClientId(clientsRefId); + if (qn == null) + { + throw new WebScriptException(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, + "Unable to find reference type: " + clientsRefId); + } + + if (logger.isDebugEnabled()) + { + StringBuilder msg = new StringBuilder(); + msg.append("Removing reference ").append(qn).append(" from ") + .append(fromNodeRef).append(" to ").append(toNodeRef); + logger.debug(msg.toString()); + } + + rmAdminService.removeCustomReference(fromNodeRef, toNodeRef, qn); + rmAdminService.removeCustomReference(toNodeRef, fromNodeRef, qn); + + result.put("success", true); + + return result; } } \ No newline at end of file diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/script/CustomRefPost.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/script/CustomRefPost.java index 105a142929..e2afbd0e55 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/script/CustomRefPost.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/script/CustomRefPost.java @@ -18,142 +18,116 @@ */ package org.alfresco.module.org_alfresco_module_rm.script; -import static org.alfresco.util.WebScriptUtils.getRequestContentAsJsonObject; -import static org.alfresco.util.WebScriptUtils.getStringValueFromJSONObject; - +import java.io.IOException; import java.util.HashMap; import java.util.Map; -import org.alfresco.module.org_alfresco_module_rm.relationship.RelationshipService; +import javax.servlet.http.HttpServletResponse; + +import org.alfresco.module.org_alfresco_module_rm.admin.RecordsManagementAdminService; import org.alfresco.service.cmr.repository.NodeRef; import org.alfresco.service.cmr.rule.RuleService; import org.alfresco.service.cmr.rule.RuleType; +import org.alfresco.service.namespace.QName; +import org.json.JSONException; import org.json.JSONObject; +import org.json.JSONTokener; import org.springframework.extensions.webscripts.Cache; import org.springframework.extensions.webscripts.Status; import org.springframework.extensions.webscripts.WebScriptException; import org.springframework.extensions.webscripts.WebScriptRequest; /** - * Implementation for Java backed webscript to add RM custom relationship to a node. + * Implementation for Java backed webscript to add RM custom reference instances + * to a node. * * @author Neil McErlean - * @author Tuna Aksoy */ public class CustomRefPost extends AbstractRmWebScript { - /** Constants */ private static final String TO_NODE = "toNode"; private static final String REF_ID = "refId"; - /** Relationship service */ - private RelationshipService relationshipService; + /** RM Admin Service */ + private RecordsManagementAdminService rmAdminService; - /** Rule service */ + /** Rule Service */ private RuleService ruleService; /** - * Gets the relationship service instance - * - * @return The relationship service instance + * @param rmAdminService RM Admin Service */ - protected RelationshipService getRelationshipService() + public void setRecordsManagementAdminService(RecordsManagementAdminService rmAdminService) { - return this.relationshipService; + this.rmAdminService = rmAdminService; } /** - * Sets the relationship service instance - * - * @param relationshipService The relationship service instance - */ - public void setRelationshipService(RelationshipService relationshipService) - { - this.relationshipService = relationshipService; - } - - /** - * Gets the rule service instance - * - * @return The rule service instance - */ - protected RuleService getRuleService() - { - return this.ruleService; - } - - /** - * Sets the rule service instance - * - * @param ruleService The rule service instance + * @param ruleService Rule Service */ public void setRuleService(RuleService ruleService) { this.ruleService = ruleService; } - /** - * @see org.springframework.extensions.webscripts.DeclarativeWebScript#executeImpl(org.springframework.extensions.webscripts.WebScriptRequest, - * org.springframework.extensions.webscripts.Status, - * org.springframework.extensions.webscripts.Cache) + /* + * @see org.alfresco.web.scripts.DeclarativeWebScript#executeImpl(org.alfresco.web.scripts.WebScriptRequest, org.alfresco.web.scripts.Status, org.alfresco.web.scripts.Cache) */ @Override protected Map executeImpl(WebScriptRequest req, Status status, Cache cache) { - Map model = new HashMap(1); + JSONObject json = null; + Map ftlModel = null; try { - getRuleService().disableRuleType(RuleType.INBOUND); - addCustomRelationship(req); - model.put(SUCCESS, true); + ruleService.disableRuleType(RuleType.INBOUND); + + json = new JSONObject(new JSONTokener(req.getContent().getContent())); + + ftlModel = addCustomReferenceInstance(req, json); + } + catch (IOException iox) + { + throw new WebScriptException(Status.STATUS_BAD_REQUEST, + "Could not read content from req.", iox); + } + catch (JSONException je) + { + throw new WebScriptException(Status.STATUS_BAD_REQUEST, + "Could not parse JSON from req.", je); } finally { - getRuleService().enableRuleType(RuleType.INBOUND); + ruleService.enableRuleType(RuleType.INBOUND); } - return model; + + return ftlModel; } /** - * Adds a custom relationship - * - * @param req The webscript request + * Applies custom reference. */ - protected void addCustomRelationship(WebScriptRequest req) + protected Map addCustomReferenceInstance(WebScriptRequest req, JSONObject json) throws JSONException { - JSONObject json = getRequestContentAsJsonObject(req); - String uniqueName = getStringValueFromJSONObject(json, REF_ID); - NodeRef target = getTargetNode(json); - NodeRef source = parseRequestForNodeRef(req); + NodeRef fromNode = parseRequestForNodeRef(req); - if (uniqueName.endsWith(INVERT)) - { - String uniqueNameStem = uniqueName.split(INVERT)[0]; - getRelationshipService().addRelationship(uniqueNameStem, target, source); - } - else - { - getRelationshipService().addRelationship(uniqueName, source, target); - } - } + Map result = new HashMap(); - /** - * Gets the target node - * - * @param json Request content as json object - * @return The target node - */ - private NodeRef getTargetNode(JSONObject json) - { - String targetNodeString = getStringValueFromJSONObject(json, TO_NODE); - NodeRef targetNode = new NodeRef(targetNodeString); + String toNodeStg = json.getString(TO_NODE); + NodeRef toNode = new NodeRef(toNodeStg); - if (!getNodeService().exists(targetNode)) + String clientsRefId = json.getString(REF_ID); + QName qn = rmAdminService.getQNameForClientId(clientsRefId); + if (qn == null) { - throw new WebScriptException(Status.STATUS_NOT_FOUND, "Unable to find the target node: '" + - targetNode.toString() + "'."); + throw new WebScriptException(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, + "Unable to find reference type: " + clientsRefId); } - return targetNode; + rmAdminService.addCustomReference(fromNode, toNode, qn); + + result.put("success", true); + + return result; } } \ No newline at end of file diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/script/CustomReferenceDefinitionBase.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/script/CustomReferenceDefinitionBase.java deleted file mode 100644 index e7e6d8c004..0000000000 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/script/CustomReferenceDefinitionBase.java +++ /dev/null @@ -1,94 +0,0 @@ -/* - * Copyright (C) 2005-2014 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - */ -package org.alfresco.module.org_alfresco_module_rm.script; - -import static org.alfresco.util.WebScriptUtils.getStringValueFromJSONObject; -import static org.apache.commons.lang.StringUtils.isBlank; - -import org.alfresco.module.org_alfresco_module_rm.relationship.RelationshipDisplayName; -import org.alfresco.module.org_alfresco_module_rm.relationship.RelationshipService; -import org.json.JSONObject; - -/** - * Base class for custom reference definition classes - * - * @author Tuna Aksoy - * @since 2.3 - */ -public class CustomReferenceDefinitionBase extends AbstractRmWebScript -{ - /** Constants for the custom reference definition classes */ - protected static final String REFERENCE_TYPE = "referenceType"; - protected static final String REF_ID = "refId"; - protected static final String LABEL = "label"; - protected static final String SOURCE = "source"; - protected static final String TARGET = "target"; - protected static final String CUSTOM_REFS = "customRefs"; - protected static final String URL = "url"; - - /** Relationship service */ - private RelationshipService relationshipService; - - /** - * Gets the relationship service instance - * - * @return The relationship service instance - */ - protected RelationshipService getRelationshipService() - { - return this.relationshipService; - } - - /** - * Sets the relationship service instance - * - * @param relationshipService The relationship service instance - */ - public void setRelationshipService(RelationshipService relationshipService) - { - this.relationshipService = relationshipService; - } - - /** - * Creates the relationship display name from request content - * - * @param requestContent The request content as json object - * @return The relationship display name - */ - protected RelationshipDisplayName createDisplayName(JSONObject requestContent) - { - String sourceText; - String targetText; - - String labelText = getStringValueFromJSONObject(requestContent, LABEL, false, false); - - if (isBlank(labelText)) - { - sourceText = getStringValueFromJSONObject(requestContent, SOURCE); - targetText = getStringValueFromJSONObject(requestContent, TARGET); - } - else - { - sourceText = labelText; - targetText = labelText; - } - - return new RelationshipDisplayName(sourceText, targetText); - } -} diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/script/CustomReferenceDefinitionPost.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/script/CustomReferenceDefinitionPost.java index 0d86218f48..f973e3da1b 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/script/CustomReferenceDefinitionPost.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/script/CustomReferenceDefinitionPost.java @@ -18,62 +18,162 @@ */ package org.alfresco.module.org_alfresco_module_rm.script; -import static org.alfresco.util.WebScriptUtils.getRequestContentAsJsonObject; - +import java.io.IOException; +import java.io.Serializable; import java.util.HashMap; +import java.util.Iterator; import java.util.Map; -import org.alfresco.module.org_alfresco_module_rm.relationship.RelationshipDefinition; -import org.alfresco.module.org_alfresco_module_rm.relationship.RelationshipDisplayName; -import org.json.JSONObject; +import org.alfresco.module.org_alfresco_module_rm.admin.RecordsManagementAdminService; +import org.alfresco.service.namespace.QName; +import org.springframework.extensions.surf.util.ParameterCheck; import org.springframework.extensions.webscripts.Cache; import org.springframework.extensions.webscripts.Status; +import org.springframework.extensions.webscripts.WebScriptException; import org.springframework.extensions.webscripts.WebScriptRequest; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.json.JSONException; +import org.json.JSONObject; +import org.json.JSONTokener; /** * Implementation for Java backed webscript to add RM custom reference definitions * to the custom model. - * + * * @author Neil McErlean - * @author Tuna Aksoy */ -public class CustomReferenceDefinitionPost extends CustomReferenceDefinitionBase +public class CustomReferenceDefinitionPost extends AbstractRmWebScript { - /** - * @see org.springframework.extensions.webscripts.DeclarativeWebScript#executeImpl(org.springframework.extensions.webscripts.WebScriptRequest, - * org.springframework.extensions.webscripts.Status, - * org.springframework.extensions.webscripts.Cache) + private static final String URL = "url"; + private static final String REF_ID = "refId"; + private static final String TARGET = "target"; + private static final String SOURCE = "source"; + private static final String LABEL = "label"; + private static final String REFERENCE_TYPE = "referenceType"; + + private static Log logger = LogFactory.getLog(CustomReferenceDefinitionPost.class); + + private RecordsManagementAdminService rmAdminService; + + public void setRecordsManagementAdminService(RecordsManagementAdminService rmAdminService) + { + this.rmAdminService = rmAdminService; + } + + /* + * @see org.alfresco.web.scripts.DeclarativeWebScript#executeImpl(org.alfresco.web.scripts.WebScriptRequest, org.alfresco.web.scripts.Status, org.alfresco.web.scripts.Cache) */ @Override protected Map executeImpl(WebScriptRequest req, Status status, Cache cache) { - JSONObject requestContent = getRequestContentAsJsonObject(req); - RelationshipDisplayName displayName = createDisplayName(requestContent); - RelationshipDefinition relationshipDefinition = getRelationshipService().createRelationshipDefinition(displayName); - - Map model = new HashMap(); - String servicePath = req.getServicePath(); - Map customRelationshipData = createRelationshipDefinitionData(relationshipDefinition, servicePath); - model.putAll(customRelationshipData); - - return model; + JSONObject json = null; + Map ftlModel = null; + try + { + json = new JSONObject(new JSONTokener(req.getContent().getContent())); + + ftlModel = addCustomReference(req, json); + } + catch (IOException iox) + { + throw new WebScriptException(Status.STATUS_BAD_REQUEST, + "Could not read content from req.", iox); + } + catch (JSONException je) + { + throw new WebScriptException(Status.STATUS_BAD_REQUEST, + "Could not parse JSON from req.", je); + } + catch (IllegalArgumentException iae) + { + throw new WebScriptException(Status.STATUS_BAD_REQUEST, + iae.getMessage(), iae); + } + + return ftlModel; } - + /** - * Creates relationship definition data for the ftl template - * - * @param relationshipDefinition The relationship definition - * @param servicePath The service path - * @return The relationship definition data + * Applies custom properties. */ - private Map createRelationshipDefinitionData(RelationshipDefinition relationshipDefinition, String servicePath) + @SuppressWarnings("rawtypes") + protected Map addCustomReference(WebScriptRequest req, JSONObject json) throws JSONException { - Map relationshipDefinitionData = new HashMap(4); - String uniqueName = relationshipDefinition.getUniqueName(); - relationshipDefinitionData.put(REFERENCE_TYPE, relationshipDefinition.getType().toString()); - relationshipDefinitionData.put(REF_ID, uniqueName); - relationshipDefinitionData.put(URL, servicePath + PATH_SEPARATOR + uniqueName); - relationshipDefinitionData.put(SUCCESS, Boolean.TRUE); - return relationshipDefinitionData; + Map result = new HashMap(); + Map params = new HashMap(); + + for (Iterator iter = json.keys(); iter.hasNext(); ) + { + String nextKeyString = (String)iter.next(); + Serializable nextValue = (Serializable)json.get(nextKeyString); + + params.put(nextKeyString, nextValue); + } + String refTypeParam = (String)params.get(REFERENCE_TYPE); + ParameterCheck.mandatory(REFERENCE_TYPE, refTypeParam); + CustomReferenceType refTypeEnum = CustomReferenceType.getEnumFromString(refTypeParam); + + boolean isChildAssoc = refTypeEnum.equals(CustomReferenceType.PARENT_CHILD); + + if (logger.isDebugEnabled()) + { + StringBuilder msg = new StringBuilder(); + msg.append("Creating custom "); + if (isChildAssoc) + { + msg.append("child "); + } + msg.append("assoc"); + logger.debug(msg.toString()); + } + + QName generatedQName; + if (isChildAssoc) + { + String source = (String)params.get(SOURCE); + String target = (String)params.get(TARGET); + + generatedQName = rmAdminService.addCustomChildAssocDefinition(source, target); + } + else + { + String label = (String)params.get(LABEL); + + generatedQName = rmAdminService.addCustomAssocDefinition(label); + } + + result.put(REFERENCE_TYPE, refTypeParam); + + String qnameLocalName; + if (refTypeParam.equals(CustomReferenceType.BIDIRECTIONAL.toString())) + { + Serializable labelParam = params.get(LABEL); + // label is mandatory for bidirectional refs only + ParameterCheck.mandatory(LABEL, labelParam); + + qnameLocalName = generatedQName.getLocalName(); + result.put(REF_ID, qnameLocalName); + } + else if (refTypeParam.equals(CustomReferenceType.PARENT_CHILD.toString())) + { + Serializable sourceParam = params.get(SOURCE); + Serializable targetParam = params.get(TARGET); + // source,target mandatory for parent/child refs only + ParameterCheck.mandatory(SOURCE, sourceParam); + ParameterCheck.mandatory(TARGET, targetParam); + + qnameLocalName = generatedQName.getLocalName(); + result.put(REF_ID, qnameLocalName); + } + else + { + throw new WebScriptException("Unsupported reference type: " + refTypeParam); + } + result.put(URL, req.getServicePath() + "/" + qnameLocalName); + + result.put("success", Boolean.TRUE); + + return result; } } \ No newline at end of file diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/script/CustomReferenceDefinitionPut.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/script/CustomReferenceDefinitionPut.java index 8483ef3b4f..a2402592e2 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/script/CustomReferenceDefinitionPut.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/script/CustomReferenceDefinitionPut.java @@ -18,16 +18,22 @@ */ package org.alfresco.module.org_alfresco_module_rm.script; -import static org.alfresco.util.WebScriptUtils.getRequestContentAsJsonObject; -import static org.alfresco.util.WebScriptUtils.getRequestParameterValue; - +import java.io.IOException; +import java.io.Serializable; import java.util.HashMap; +import java.util.Iterator; import java.util.Map; -import org.alfresco.module.org_alfresco_module_rm.relationship.RelationshipDisplayName; +import org.alfresco.module.org_alfresco_module_rm.admin.RecordsManagementAdminService; +import org.alfresco.service.cmr.dictionary.AssociationDefinition; +import org.alfresco.service.cmr.dictionary.ChildAssociationDefinition; +import org.alfresco.service.namespace.QName; +import org.json.JSONException; import org.json.JSONObject; +import org.json.JSONTokener; import org.springframework.extensions.webscripts.Cache; import org.springframework.extensions.webscripts.Status; +import org.springframework.extensions.webscripts.WebScriptException; import org.springframework.extensions.webscripts.WebScriptRequest; /** @@ -36,44 +42,113 @@ import org.springframework.extensions.webscripts.WebScriptRequest; * the source/target (for parent/child references). * * @author Neil McErlean - * @author Tuna Aksoy */ -public class CustomReferenceDefinitionPut extends CustomReferenceDefinitionBase +public class CustomReferenceDefinitionPut extends AbstractRmWebScript { - /** - * @see org.springframework.extensions.webscripts.DeclarativeWebScript#executeImpl(org.springframework.extensions.webscripts.WebScriptRequest, - * org.springframework.extensions.webscripts.Status, - * org.springframework.extensions.webscripts.Cache) + private static final String URL = "url"; + private static final String REF_ID = "refId"; + private static final String TARGET = "target"; + private static final String SOURCE = "source"; + private static final String LABEL = "label"; + + private RecordsManagementAdminService rmAdminService; + + public void setRecordsManagementAdminService(RecordsManagementAdminService rmAdminService) + { + this.rmAdminService = rmAdminService; + } + + /* + * @see org.alfresco.web.scripts.DeclarativeWebScript#executeImpl(org.alfresco.web.scripts.WebScriptRequest, org.alfresco.web.scripts.Status, org.alfresco.web.scripts.Cache) */ @Override protected Map executeImpl(WebScriptRequest req, Status status, Cache cache) { - String uniqueName = getRequestParameterValue(req, REF_ID); - JSONObject requestContent = getRequestContentAsJsonObject(req); - RelationshipDisplayName displayName = createDisplayName(requestContent); - getRelationshipService().updateRelationshipDefinition(uniqueName, displayName); + JSONObject json = null; + Map ftlModel = null; + try + { + json = new JSONObject(new JSONTokener(req.getContent().getContent())); - Map model = new HashMap(); - String servicePath = req.getServicePath(); - Map customReferenceData = createRelationshipDefinitionData(servicePath, uniqueName); - model.putAll(customReferenceData); + ftlModel = updateCustomReference(req, json); + } + catch (IOException iox) + { + throw new WebScriptException(Status.STATUS_BAD_REQUEST, + "Could not read content from req.", iox); + } + catch (JSONException je) + { + throw new WebScriptException(Status.STATUS_BAD_REQUEST, + "Could not parse JSON from req.", je); + } + catch (IllegalArgumentException iae) + { + throw new WebScriptException(Status.STATUS_BAD_REQUEST, + iae.getMessage(), iae); + } - return model; + return ftlModel; } /** - * Creates relationship definition data for the ftl template - * - * @param servicePath The service path - * @param String The relationship unique name - * @return The relationship definition data + * Applies custom properties. */ - private Map createRelationshipDefinitionData(String servicePath, String uniqueName) + @SuppressWarnings("rawtypes") + protected Map updateCustomReference(WebScriptRequest req, JSONObject json) throws JSONException { - Map relationshipDefinitionData = new HashMap(3); - relationshipDefinitionData.put(URL, servicePath); - relationshipDefinitionData.put(REF_ID, uniqueName); - relationshipDefinitionData.put(SUCCESS, Boolean.TRUE); - return relationshipDefinitionData; + Map result = new HashMap(); + Map params = new HashMap(); + + for (Iterator iter = json.keys(); iter.hasNext(); ) + { + String nextKeyString = (String)iter.next(); + Serializable nextValue = (Serializable)json.get(nextKeyString); + + params.put(nextKeyString, nextValue); + } + + Map templateVars = req.getServiceMatch().getTemplateVars(); + String refId = templateVars.get(REF_ID); + // refId cannot be null as it is defined within the URL + params.put(REF_ID, (Serializable)refId); + + // Ensure that the reference actually exists. + QName refQName = rmAdminService.getQNameForClientId(refId); + if (refQName == null) + { + throw new WebScriptException(Status.STATUS_NOT_FOUND, + "Could not find reference definition for: " + refId); + } + + String newLabel = (String)params.get(LABEL); + String newSource = (String)params.get(SOURCE); + String newTarget = (String)params.get(TARGET); + + // Determine whether it's a bidi or a p/c ref + AssociationDefinition assocDef = rmAdminService.getCustomReferenceDefinitions().get(refQName); + if (assocDef == null) + { + throw new WebScriptException(Status.STATUS_NOT_FOUND, + "Could not find reference definition for: " + refId); + } + + if (assocDef instanceof ChildAssociationDefinition) + { + if (newSource != null || newTarget != null) + { + rmAdminService.updateCustomChildAssocDefinition(refQName, newSource, newTarget); + } + } + else if (newLabel != null) + { + rmAdminService.updateCustomAssocDefinition(refQName, newLabel); + } + + result.put(URL, req.getServicePath()); + result.put("refId", refQName.getLocalName()); + result.put("success", Boolean.TRUE); + + return result; } } \ No newline at end of file diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/script/CustomReferenceDefinitionsGet.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/script/CustomReferenceDefinitionsGet.java index e389dadb25..72898c62f8 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/script/CustomReferenceDefinitionsGet.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/script/CustomReferenceDefinitionsGet.java @@ -18,119 +18,141 @@ */ package org.alfresco.module.org_alfresco_module_rm.script; -import static org.alfresco.util.WebScriptUtils.getRequestParameterValue; -import static org.apache.commons.lang3.StringUtils.isBlank; - import java.util.ArrayList; import java.util.HashMap; -import java.util.HashSet; import java.util.List; import java.util.Map; -import java.util.Set; +import java.util.Map.Entry; -import org.alfresco.module.org_alfresco_module_rm.relationship.RelationshipDefinition; -import org.alfresco.module.org_alfresco_module_rm.relationship.RelationshipDisplayName; -import org.alfresco.module.org_alfresco_module_rm.relationship.RelationshipType; +import javax.servlet.http.HttpServletResponse; + +import org.alfresco.module.org_alfresco_module_rm.admin.RecordsManagementAdminService; +import org.alfresco.service.cmr.dictionary.AssociationDefinition; +import org.alfresco.service.cmr.dictionary.ChildAssociationDefinition; +import org.alfresco.service.cmr.dictionary.DictionaryService; +import org.alfresco.service.namespace.QName; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import org.springframework.extensions.webscripts.Cache; +import org.springframework.extensions.webscripts.DeclarativeWebScript; import org.springframework.extensions.webscripts.Status; import org.springframework.extensions.webscripts.WebScriptException; import org.springframework.extensions.webscripts.WebScriptRequest; /** - * Implementation for Java backed webscript to get RM custom reference definitions. + * This class provides the implementation for the customrefdefinitions.get webscript. * * @author Neil McErlean - * @author Tuna Aksoy */ -public class CustomReferenceDefinitionsGet extends CustomReferenceDefinitionBase +public class CustomReferenceDefinitionsGet extends DeclarativeWebScript { - /** - * @see org.springframework.extensions.webscripts.DeclarativeWebScript#executeImpl(org.springframework.extensions.webscripts.WebScriptRequest, - * org.springframework.extensions.webscripts.Status, - * org.springframework.extensions.webscripts.Cache) - */ + private static final String REFERENCE_TYPE = "referenceType"; + private static final String REF_ID = "refId"; + private static final String LABEL = "label"; + private static final String SOURCE = "source"; + private static final String TARGET = "target"; + private static final String CUSTOM_REFS = "customRefs"; + private static Log logger = LogFactory.getLog(CustomReferenceDefinitionsGet.class); + + private RecordsManagementAdminService rmAdminService; + private DictionaryService dictionaryService; + + public void setRecordsManagementAdminService(RecordsManagementAdminService rmAdminService) + { + this.rmAdminService = rmAdminService; + } + + public void setDictionaryService(DictionaryService dictionaryService) + { + this.dictionaryService = dictionaryService; + } + @Override - protected Map executeImpl(WebScriptRequest req, Status status, Cache cache) + public Map executeImpl(WebScriptRequest req, Status status, Cache cache) { - String uniqueName = getRequestParameterValue(req, REF_ID, false); - Set relationshipDefinitions = getRelationshipDefinitons(uniqueName); - List> relationshipDefinitionData = createRelationshipDefinitionData(relationshipDefinitions); - Map model = new HashMap(); - model.put(CUSTOM_REFS, relationshipDefinitionData); - return model; - } - /** - * Gets the relationship definition for the unique name. If the unique - * name is blank all relationship definitions will be retrieved - * - * @param uniqueName The unique name of the relationship definition - * @return Relationship definition for the given unique name or all - * relationship definitions if unique name is blank - */ - private Set getRelationshipDefinitons(String uniqueName) - { - Set relationshipDefinitions = new HashSet(); + Map templateVars = req.getServiceMatch().getTemplateVars(); + String refId = templateVars.get(REF_ID); - if (isBlank(uniqueName)) + if (logger.isDebugEnabled()) { - relationshipDefinitions.addAll(getRelationshipService().getRelationshipDefinitions()); + logger.debug("Getting custom reference definitions with refId: " + refId); } - else + + Map currentCustomRefs = rmAdminService.getCustomReferenceDefinitions(); + + // If refId has been provided then this is a request for a single custom-ref-defn. + // else it is a request for them all. + if (refId != null) { - RelationshipDefinition relationshipDefinition = getRelationshipService().getRelationshipDefinition(uniqueName); - if (relationshipDefinition != null) + QName qn = rmAdminService.getQNameForClientId(refId); + + AssociationDefinition assDef = currentCustomRefs.get(qn); + if (assDef == null) { - relationshipDefinitions.add(relationshipDefinition); + StringBuilder msg = new StringBuilder(); + msg.append("Unable to find reference: ").append(refId); + if (logger.isDebugEnabled()) + { + logger.debug(msg.toString()); + } + throw new WebScriptException(HttpServletResponse.SC_NOT_FOUND, + msg.toString()); } + + currentCustomRefs = new HashMap(1); + currentCustomRefs.put(qn, assDef); } - return relationshipDefinitions; - } + List> listOfReferenceData = new ArrayList>(); - /** - * Creates relationship definition data for the ftl template - * - * @param relationshipDefinitions The relationship definitions - * @return The relationship definition data - */ - private List> createRelationshipDefinitionData(Set relationshipDefinitions) - { - List> relationshipDefinitionData = new ArrayList>(); - - for (RelationshipDefinition relationshipDefinition : relationshipDefinitions) + for (Entry entry : currentCustomRefs.entrySet()) { Map data = new HashMap(); - RelationshipType type = relationshipDefinition.getType(); - RelationshipDisplayName displayName = relationshipDefinition.getDisplayName(); + AssociationDefinition nextValue = entry.getValue(); - if (RelationshipType.BIDIRECTIONAL.equals(type)) + CustomReferenceType referenceType = nextValue instanceof ChildAssociationDefinition ? + CustomReferenceType.PARENT_CHILD : CustomReferenceType.BIDIRECTIONAL; + + data.put(REFERENCE_TYPE, referenceType.toString()); + + // It is the title which stores either the label, or the source and target. + String nextTitle = nextValue.getTitle(dictionaryService); + if (CustomReferenceType.PARENT_CHILD.equals(referenceType)) { - data.put(LABEL, displayName.getSourceText()); + if (nextTitle != null) + { + String[] sourceAndTarget = rmAdminService.splitSourceTargetId(nextTitle); + data.put(SOURCE, sourceAndTarget[0]); + data.put(TARGET, sourceAndTarget[1]); + data.put(REF_ID, entry.getKey().getLocalName()); + } } - else if (RelationshipType.PARENTCHILD.equals(type)) + else if (CustomReferenceType.BIDIRECTIONAL.equals(referenceType)) { - data.put(SOURCE, displayName.getSourceText()); - data.put(TARGET, displayName.getTargetText()); + if (nextTitle != null) + { + data.put(LABEL, nextTitle); + data.put(REF_ID, entry.getKey().getLocalName()); + } } else { - StringBuilder sb = new StringBuilder(); - sb.append("Unsupported relationship type '") - .append(type) - .append("'."); - - throw new WebScriptException(Status.STATUS_BAD_REQUEST, sb.toString()); + throw new WebScriptException("Unsupported custom reference type: " + referenceType); } - data.put(REF_ID, relationshipDefinition.getUniqueName()); - data.put(REFERENCE_TYPE, type.toString().toLowerCase()); - - relationshipDefinitionData.add(data); + listOfReferenceData.add(data); } - return relationshipDefinitionData; + if (logger.isDebugEnabled()) + { + logger.debug("Retrieved custom reference definitions: " + listOfReferenceData.size()); + } + + model.put(CUSTOM_REFS, listOfReferenceData); + + return model; } } \ No newline at end of file diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/script/CustomReferenceType.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/script/CustomReferenceType.java index 7618457f0f..a77676fb06 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/script/CustomReferenceType.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/script/CustomReferenceType.java @@ -18,13 +18,10 @@ */ package org.alfresco.module.org_alfresco_module_rm.script; -import org.alfresco.module.org_alfresco_module_rm.relationship.RelationshipType; - /** * This enum represents the allowed types of custom references. - * + * * @author Neil McErlean - * @deprecated as of RM 2.3, please use {@link RelationshipType} instead. */ public enum CustomReferenceType { @@ -32,18 +29,18 @@ public enum CustomReferenceType BIDIRECTIONAL("bidirectional"); private final String printableString; - + private CustomReferenceType(String printableString) { this.printableString = printableString; } - + @Override public String toString() { return this.printableString; } - + public static CustomReferenceType getEnumFromString(String stg) { for (CustomReferenceType type : CustomReferenceType.values()) diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/script/CustomRefsGet.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/script/CustomRefsGet.java index cd240f689a..d86b981b76 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/script/CustomRefsGet.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/script/CustomRefsGet.java @@ -22,33 +22,32 @@ import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; -import java.util.Set; import org.alfresco.model.ContentModel; +import org.alfresco.module.org_alfresco_module_rm.admin.RecordsManagementAdminService; import org.alfresco.module.org_alfresco_module_rm.capability.Capability; import org.alfresco.module.org_alfresco_module_rm.capability.CapabilityService; import org.alfresco.module.org_alfresco_module_rm.capability.impl.ViewRecordsCapability; -import org.alfresco.module.org_alfresco_module_rm.relationship.Relationship; -import org.alfresco.module.org_alfresco_module_rm.relationship.RelationshipDefinition; -import org.alfresco.module.org_alfresco_module_rm.relationship.RelationshipDisplayName; -import org.alfresco.module.org_alfresco_module_rm.relationship.RelationshipService; -import org.alfresco.module.org_alfresco_module_rm.relationship.RelationshipType; +import org.alfresco.service.cmr.dictionary.AssociationDefinition; +import org.alfresco.service.cmr.dictionary.DictionaryService; +import org.alfresco.service.cmr.repository.AssociationRef; +import org.alfresco.service.cmr.repository.ChildAssociationRef; import org.alfresco.service.cmr.repository.NodeRef; import org.alfresco.service.cmr.security.AccessStatus; +import org.alfresco.service.namespace.QName; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import org.springframework.extensions.webscripts.Cache; import org.springframework.extensions.webscripts.Status; -import org.springframework.extensions.webscripts.WebScriptException; import org.springframework.extensions.webscripts.WebScriptRequest; /** - * Implementation for Java backed webscript to get RM custom references for a node. + * This class provides the implementation for the customrefs.get webscript. * * @author Neil McErlean - * @author Tuna Aksoy */ public class CustomRefsGet extends AbstractRmWebScript { - /** Constants */ private static final String REFERENCE_TYPE = "referenceType"; private static final String REF_ID = "refId"; private static final String LABEL = "label"; @@ -63,46 +62,36 @@ public class CustomRefsGet extends AbstractRmWebScript private static final String NODE_NAME = "nodeName"; private static final String NODE_TITLE = "nodeTitle"; - /** Relationship service */ - private RelationshipService relationshipService; + /** logger */ + private static Log logger = LogFactory.getLog(CustomRefsGet.class); - /** Capability service */ + /** records management admin service */ + private RecordsManagementAdminService rmAdminService; + + /** dictionary service */ + private DictionaryService dictionaryService; + + /** capability service */ private CapabilityService capabilityService; /** - * Gets the relationship service instance - * - * @return The relationship service instance + * @param rmAdminService records management admin service */ - protected RelationshipService getRelationshipService() + public void setRecordsManagementAdminService(RecordsManagementAdminService rmAdminService) { - return this.relationshipService; + this.rmAdminService = rmAdminService; } /** - * Sets the relationship service instance - * - * @param relationshipService The relationship service instance + * @param dictionaryService dictionary service */ - public void setRelationshipService(RelationshipService relationshipService) + public void setDictionaryService(DictionaryService dictionaryService) { - this.relationshipService = relationshipService; + this.dictionaryService = dictionaryService; } /** - * Gets the capability service instance - * - * @return The capability service instance - */ - protected CapabilityService getCapabilityService() - { - return this.capabilityService; - } - - /** - * Sets the capability service instance - * - * @param capabilityService Capability service instance + * @param capabilityService capability service */ public void setCapabilityService(CapabilityService capabilityService) { @@ -110,125 +99,137 @@ public class CustomRefsGet extends AbstractRmWebScript } /** - * @see org.springframework.extensions.webscripts.DeclarativeWebScript#executeImpl(org.springframework.extensions.webscripts.WebScriptRequest, - * org.springframework.extensions.webscripts.Status, - * org.springframework.extensions.webscripts.Cache) + * @see org.springframework.extensions.webscripts.DeclarativeWebScript#executeImpl(org.springframework.extensions.webscripts.WebScriptRequest, org.springframework.extensions.webscripts.Status, org.springframework.extensions.webscripts.Cache) */ @Override - protected Map executeImpl(WebScriptRequest req, Status status, Cache cache) + public Map executeImpl(WebScriptRequest req, Status status, Cache cache) { - Map model = new HashMap(4); - NodeRef nodeRef = parseRequestForNodeRef(req); - model.put(NODE_NAME, getNodeService().getProperty(nodeRef, ContentModel.PROP_NAME)); - model.put(NODE_TITLE, getNodeService().getProperty(nodeRef, ContentModel.PROP_TITLE)); - model.put(CUSTOM_REFS_FROM, getOutwardReferences(nodeRef)); - model.put(CUSTOM_REFS_TO, getInwardReferenceData(nodeRef)); - return model; - } + Map ftlModel = new HashMap(); - /** - * Gets all the references that come 'out' from this node - * - * @param nodeRef Node reference - * @return All the references that come 'out' from this node - */ - private List> getOutwardReferences(NodeRef nodeRef) - { - List> outwardReferenceData = new ArrayList>(); - Set relationships = getRelationshipService().getRelationshipsFrom(nodeRef); - outwardReferenceData.addAll(getRelationshipData(relationships)); - return outwardReferenceData; - } + NodeRef node = parseRequestForNodeRef(req); - /** - * Gets all the references that come 'in' to this node - * - * @param nodeRef Node reference - * @return All the references that come 'in' to this node - */ - private List> getInwardReferenceData(NodeRef nodeRef) - { - List> inwardReferenceData = new ArrayList>(); - Set relationships = getRelationshipService().getRelationshipsTo(nodeRef); - inwardReferenceData.addAll(getRelationshipData(relationships)); - return inwardReferenceData; - } - - /** - * Creates relationship data for the ftl template - * - * @param relationships The relationships - * @return The relationship data - */ - private List> getRelationshipData(Set relationships) - { - List> relationshipData = new ArrayList>(); - - for (Relationship relationship : relationships) + if (logger.isDebugEnabled()) { - String uniqueName = relationship.getUniqueName(); - RelationshipDefinition relationshipDefinition = getRelationshipService().getRelationshipDefinition(uniqueName); - - NodeRef source = relationship.getSource(); - NodeRef target = relationship.getTarget(); - - if (relationshipDefinition != null && hasView(source) && hasView(target)) - { - Map data = new HashMap(); - - RelationshipType type = relationshipDefinition.getType(); - RelationshipDisplayName displayName = relationshipDefinition.getDisplayName(); - - if (RelationshipType.BIDIRECTIONAL.equals(type)) - { - data.put(LABEL, displayName.getSourceText()); - data.put(SOURCE_REF, source.toString()); - data.put(TARGET_REF, target.toString()); - } - else if (RelationshipType.PARENTCHILD.equals(type)) - { - data.put(SOURCE, displayName.getSourceText()); - data.put(TARGET, displayName.getTargetText()); - data.put(PARENT_REF, source.toString()); - data.put(CHILD_REF, target.toString()); - } - else - { - StringBuilder sb = new StringBuilder(); - sb.append("Unsupported relationship type '") - .append(type) - .append("'."); - - throw new WebScriptException(Status.STATUS_BAD_REQUEST, sb.toString()); - } - - data.put(REFERENCE_TYPE, type.toString().toLowerCase()); - data.put(REF_ID, uniqueName); - - relationshipData.add(data); - } - + logger.debug("Getting custom reference instances for " + node); } - return relationshipData; + // All the references that come 'out' from this node. + List> listOfOutwardReferenceData = new ArrayList>(); + + List assocsFromThisNode = this.rmAdminService.getCustomReferencesFrom(node); + addBidirectionalReferenceData(listOfOutwardReferenceData, assocsFromThisNode); + + List childAssocs = this.rmAdminService.getCustomChildReferences(node); + addParentChildReferenceData(listOfOutwardReferenceData, childAssocs); + + // All the references that come 'in' to this node. + List> listOfInwardReferenceData = new ArrayList>(); + + List toAssocs = this.rmAdminService.getCustomReferencesTo(node); + addBidirectionalReferenceData(listOfInwardReferenceData, toAssocs); + + List parentAssocs = this.rmAdminService.getCustomParentReferences(node); + addParentChildReferenceData(listOfInwardReferenceData, parentAssocs); + + if (logger.isDebugEnabled()) + { + logger.debug("Retrieved custom reference instances: " + assocsFromThisNode); + } + + ftlModel.put(NODE_NAME, nodeService.getProperty(node, ContentModel.PROP_NAME)); + ftlModel.put(NODE_TITLE, nodeService.getProperty(node, ContentModel.PROP_TITLE)); + ftlModel.put(CUSTOM_REFS_FROM, listOfOutwardReferenceData); + ftlModel.put(CUSTOM_REFS_TO, listOfInwardReferenceData); + + return ftlModel; } /** - * Determines whether the current user has view capabilities on the given node. + * This method goes through the associationRefs specified and constructs a Map + * for each assRef. FTL-relevant data are added to that map. The associationRefs must all be + * parent/child references. * - * @param nodeRef Node reference - * @return boolean true if current user has view capability, false otherwise + * @param listOfReferenceData + * @param assocs + */ + private void addParentChildReferenceData(List> listOfReferenceData,List childAssocs) + { + for (ChildAssociationRef childAssRef : childAssocs) + { + Map data = new HashMap(); + + QName typeQName = childAssRef.getTypeQName(); + + data.put(CHILD_REF, childAssRef.getChildRef().toString()); + data.put(PARENT_REF, childAssRef.getParentRef().toString()); + + AssociationDefinition assDef = rmAdminService.getCustomReferenceDefinitions().get(typeQName); + + if (assDef != null && + hasView(childAssRef.getParentRef()) && + hasView(childAssRef.getChildRef())) + { + String compoundTitle = assDef.getTitle(dictionaryService); + + data.put(REF_ID, typeQName.getLocalName()); + + String[] sourceAndTarget = rmAdminService.splitSourceTargetId(compoundTitle); + data.put(SOURCE, sourceAndTarget[0]); + data.put(TARGET, sourceAndTarget[1]); + data.put(REFERENCE_TYPE, CustomReferenceType.PARENT_CHILD.toString()); + + listOfReferenceData.add(data); + } + } + } + + /** + * This method goes through the associationRefs specified and constructs a Map + * for each assRef. FTL-relevant data are added to that map. The associationRefs must all be + * bidirectional references. + * + * @param listOfReferenceData + * @param assocs + */ + private void addBidirectionalReferenceData(List> listOfReferenceData, List assocs) + { + for (AssociationRef assRef : assocs) + { + Map data = new HashMap(); + + QName typeQName = assRef.getTypeQName(); + AssociationDefinition assDef = rmAdminService.getCustomReferenceDefinitions().get(typeQName); + + if (assDef != null && + hasView(assRef.getTargetRef()) && + hasView(assRef.getSourceRef())) + { + data.put(LABEL, assDef.getTitle(dictionaryService)); + data.put(REF_ID, typeQName.getLocalName()); + data.put(REFERENCE_TYPE, CustomReferenceType.BIDIRECTIONAL.toString()); + data.put(SOURCE_REF, assRef.getSourceRef().toString()); + data.put(TARGET_REF, assRef.getTargetRef().toString()); + + listOfReferenceData.add(data); + } + } + } + + /** + * Determine whether the current user has view capabilities on the given node. + * + * @param nodeRef node reference + * @return boolean true if current user has view capability, false otherwise */ private boolean hasView(NodeRef nodeRef) { boolean result = false; - Capability viewRecordCapability = getCapabilityService().getCapability(ViewRecordsCapability.NAME); + Capability viewRecordCapability = capabilityService.getCapability(ViewRecordsCapability.NAME); if (AccessStatus.ALLOWED.equals(viewRecordCapability.hasPermission(nodeRef))) { result = true; } - return result; } } \ No newline at end of file diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/script/DataSetPost.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/script/DataSetPost.java index 26ac093d52..9a3df3bfda 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/script/DataSetPost.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/script/DataSetPost.java @@ -9,6 +9,7 @@ import org.alfresco.module.org_alfresco_module_rm.model.rma.type.RmSiteType; import org.alfresco.service.cmr.repository.NodeRef; import org.alfresco.service.cmr.site.SiteService; import org.apache.commons.lang.StringUtils; +import org.apache.commons.lang.exception.ExceptionUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.springframework.extensions.webscripts.Cache; @@ -21,7 +22,7 @@ public class DataSetPost extends DeclarativeWebScript implements RecordsManageme { /** Constant for the site name parameter */ private static final String ARG_SITE_NAME = "site"; - + /** Constant for the data set id parameter */ private static final String ARG_DATA_SET_ID = "dataSetId"; @@ -36,7 +37,7 @@ public class DataSetPost extends DeclarativeWebScript implements RecordsManageme /** * Set site service - * + * * @param siteService the site service */ public void setSiteService(SiteService siteService) @@ -46,7 +47,7 @@ public class DataSetPost extends DeclarativeWebScript implements RecordsManageme /** * Data set service - * + * * @param dataSetService the data set service */ public void setDataSetService(DataSetService dataSetService) @@ -76,21 +77,21 @@ public class DataSetPost extends DeclarativeWebScript implements RecordsManageme throw new WebScriptException(Status.STATUS_NOT_FOUND, "A data set with the id '" + dataSetId + "'" + " does not exist."); } - + // Resolve RM site String siteName = req.getParameter(ARG_SITE_NAME); if (StringUtils.isBlank(siteName)) { siteName = RmSiteType.DEFAULT_SITE_NAME; } - + // Check the site if it exists if (siteService.getSite(siteName) == null) { throw new WebScriptException(Status.STATUS_BAD_REQUEST, "A Records Management site with the name '" + siteName + "' does not exist."); } - + // Resolve documentLibrary (filePlan) container NodeRef filePlan = siteService.getContainer(siteName, RmSiteType.COMPONENT_DOCUMENT_LIBRARY); if (filePlan == null) @@ -98,7 +99,7 @@ public class DataSetPost extends DeclarativeWebScript implements RecordsManageme filePlan = siteService.createContainer(siteName, RmSiteType.COMPONENT_DOCUMENT_LIBRARY, TYPE_FILE_PLAN, null); } - + // Load data set in to the file plan dataSetService.loadDataSet(filePlan, dataSetId); @@ -109,7 +110,7 @@ public class DataSetPost extends DeclarativeWebScript implements RecordsManageme { model.put("success", false); model.put("message", ex.getMessage()); - logger.error("Error while importing data set: " + ex); + logger.error(ExceptionUtils.getFullStackTrace(ex)); } return model; diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/script/DispositionAbstractBase.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/script/DispositionAbstractBase.java index f3e2e8f771..a73e2a0c67 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/script/DispositionAbstractBase.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/script/DispositionAbstractBase.java @@ -63,11 +63,11 @@ public class DispositionAbstractBase extends AbstractRmWebScript DispositionSchedule schedule = null; if (inherited) { - schedule = getDispositionService().getDispositionSchedule(nodeRef); + schedule = this.dispositionService.getDispositionSchedule(nodeRef); } else { - schedule = getDispositionService().getAssociatedDispositionSchedule(nodeRef); + schedule = dispositionService.getAssociatedDispositionSchedule(nodeRef); } if (schedule == null) { @@ -132,7 +132,7 @@ public class DispositionAbstractBase extends AbstractRmWebScript if (actionDef.getPeriodProperty() != null) { - model.put("periodProperty", actionDef.getPeriodProperty().toPrefixString(getNamespaceService())); + model.put("periodProperty", actionDef.getPeriodProperty().toPrefixString(this.namespaceService)); } if (actionDef.getLocation() != null) @@ -181,7 +181,7 @@ public class DispositionAbstractBase extends AbstractRmWebScript scheduleModel.put("nodeRef", schedule.getNodeRef().toString()); scheduleModel.put("recordLevelDisposition", schedule.isRecordLevelDisposition()); scheduleModel.put("canStepsBeRemoved", - !getDispositionService().hasDisposableItems(schedule)); + !this.dispositionService.hasDisposableItems(schedule)); if (schedule.getDispositionAuthority() != null) { @@ -200,10 +200,10 @@ public class DispositionAbstractBase extends AbstractRmWebScript for (DispositionActionDefinition actionDef : schedule.getDispositionActionDefinitions()) { NodeRef actionDefNodeRef = actionDef.getNodeRef(); - if (getNodeService().hasAspect(actionDefNodeRef, RecordsManagementModel.ASPECT_UNPUBLISHED_UPDATE)) + if (nodeService.hasAspect(actionDefNodeRef, RecordsManagementModel.ASPECT_UNPUBLISHED_UPDATE)) { unpublishedUpdates = true; - publishInProgress = ((Boolean) getNodeService().getProperty(actionDefNodeRef, RecordsManagementModel.PROP_PUBLISH_IN_PROGRESS)).booleanValue(); + publishInProgress = ((Boolean)nodeService.getProperty(actionDefNodeRef, RecordsManagementModel.PROP_PUBLISH_IN_PROGRESS)).booleanValue(); } actions.add(createActionDefModel(actionDef, actionsUrl + "/" + actionDef.getId())); diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/script/DispositionActionDefinitionDelete.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/script/DispositionActionDefinitionDelete.java index 3fc0dbb8a6..e224812af9 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/script/DispositionActionDefinitionDelete.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/script/DispositionActionDefinitionDelete.java @@ -67,7 +67,7 @@ public class DispositionActionDefinitionDelete extends DispositionAbstractBase { if (dispositionActionDefinition.getIndex() >= index) { - getDispositionService().removeDispositionActionDefinition(schedule, dispositionActionDefinition); + dispositionService.removeDispositionActionDefinition(schedule, dispositionActionDefinition); } } } diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/script/DispositionActionDefinitionPost.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/script/DispositionActionDefinitionPost.java index dbcaf2569c..fe9a6384b1 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/script/DispositionActionDefinitionPost.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/script/DispositionActionDefinitionPost.java @@ -114,7 +114,7 @@ public class DispositionActionDefinitionPost extends DispositionAbstractBase if (json.has("periodProperty")) { - QName periodProperty = QName.createQName(json.getString("periodProperty"), getNamespaceService()); + QName periodProperty = QName.createQName(json.getString("periodProperty"), this.namespaceService); props.put(RecordsManagementModel.PROP_DISPOSITION_PERIOD_PROPERTY, periodProperty); } @@ -154,6 +154,6 @@ public class DispositionActionDefinitionPost extends DispositionAbstractBase } // add the action definition to the schedule - return getDispositionService().addDispositionActionDefinition(schedule, props); + return this.dispositionService.addDispositionActionDefinition(schedule, props); } } \ No newline at end of file diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/script/DispositionActionDefinitionPut.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/script/DispositionActionDefinitionPut.java index 68ba13854b..9f2d8ad025 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/script/DispositionActionDefinitionPut.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/script/DispositionActionDefinitionPut.java @@ -41,7 +41,7 @@ import org.springframework.extensions.webscripts.WebScriptRequest; /** * Implementation for Java backed webscript to update an existing dispositon * action definition. - * + * * @author Gavin Cornwell */ public class DispositionActionDefinitionPut extends DispositionAbstractBase @@ -84,7 +84,7 @@ public class DispositionActionDefinitionPut extends DispositionAbstractBase /** * Updates a dispositionActionDefinition node in the repo. - * + * * @param actionDef The action definition to update * @param json The JSON to use to create the action definition * @param schedule The DispositionSchedule the action definition belongs to @@ -113,7 +113,7 @@ public class DispositionActionDefinitionPut extends DispositionAbstractBase if (json.has("periodProperty")) { - QName periodProperty = QName.createQName(json.getString("periodProperty"), getNamespaceService()); + QName periodProperty = QName.createQName(json.getString("periodProperty"), this.namespaceService); props.put(RecordsManagementModel.PROP_DISPOSITION_PERIOD_PROPERTY, periodProperty); } @@ -153,6 +153,6 @@ public class DispositionActionDefinitionPut extends DispositionAbstractBase } // update the action definition - return getDispositionService().updateDispositionActionDefinition(actionDef, props); + return this.dispositionService.updateDispositionActionDefinition(actionDef, props); } } \ No newline at end of file diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/script/DispositionLifecycleGet.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/script/DispositionLifecycleGet.java index 70dbb265d5..83c5dc4132 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/script/DispositionLifecycleGet.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/script/DispositionLifecycleGet.java @@ -36,23 +36,23 @@ import org.springframework.extensions.webscripts.WebScriptRequest; /** * Implementation for Java backed webscript to return full details * about a disposition lifecycle (next disposition action). - * + * * @author Gavin Cornwell */ public class DispositionLifecycleGet extends DispositionAbstractBase { PersonService personService; - + /** * Sets the PersonService instance - * + * * @param personService The PersonService instance */ public void setPersonService(PersonService personService) { this.personService = personService; } - + /* * @see org.alfresco.web.scripts.DeclarativeWebScript#executeImpl(org.alfresco.web.scripts.WebScriptRequest, org.alfresco.web.scripts.Status, org.alfresco.web.scripts.Cache) */ @@ -61,9 +61,9 @@ public class DispositionLifecycleGet extends DispositionAbstractBase { // parse the request to retrieve the next action NodeRef nodeRef = parseRequestForNodeRef(req); - + // make sure the node passed in has a next action attached - DispositionAction nextAction = getDispositionService().getNextDispositionAction(nodeRef); + DispositionAction nextAction = this.dispositionService.getNextDispositionAction(nodeRef); if (nextAction == null) { Map nextActionModel = new HashMap(2); @@ -81,84 +81,84 @@ public class DispositionLifecycleGet extends DispositionAbstractBase nextActionModel.put("url", serviceUrl); nextActionModel.put("name", nextAction.getName()); nextActionModel.put("label", nextAction.getLabel()); - nextActionModel.put("eventsEligible", getDispositionService().isNextDispositionActionEligible(nodeRef)); - + nextActionModel.put("eventsEligible", this.dispositionService.isNextDispositionActionEligible(nodeRef)); + if (nextAction.getAsOfDate() != null) { nextActionModel.put("asOf", ISO8601DateFormat.format(nextAction.getAsOfDate())); } - + if (nextAction.getStartedAt() != null) { nextActionModel.put("startedAt", ISO8601DateFormat.format(nextAction.getStartedAt())); } - + String startedBy = nextAction.getStartedBy(); if (startedBy != null) { nextActionModel.put("startedBy", startedBy); addUsersRealName(nextActionModel, startedBy, "startedBy"); } - + if (nextAction.getCompletedAt() != null) { nextActionModel.put("completedAt", ISO8601DateFormat.format(nextAction.getCompletedAt())); } - + String completedBy = nextAction.getCompletedBy(); if (completedBy != null) { nextActionModel.put("completedBy", completedBy); addUsersRealName(nextActionModel, completedBy, "completedBy"); } - + List> events = new ArrayList>(); for (EventCompletionDetails event : nextAction.getEventCompletionDetails()) { events.add(createEventModel(event)); } nextActionModel.put("events", events); - + // create model object with just the schedule data Map model = new HashMap(1); model.put("nextaction", nextActionModel); return model; } } - + /** * Helper to create a model to represent the given event execution. - * + * * @param event The event to create a model for * @return Map representing the model */ protected Map createEventModel(EventCompletionDetails event) { Map model = new HashMap(8); - + model.put("name", event.getEventName()); model.put("label", event.getEventLabel()); model.put("automatic", event.isEventExecutionAutomatic()); model.put("complete", event.isEventComplete()); - + String completedBy = event.getEventCompletedBy(); if (completedBy != null) { model.put("completedBy", completedBy); addUsersRealName(model, completedBy, "completedBy"); } - + if (event.getEventCompletedAt() != null) { model.put("completedAt", ISO8601DateFormat.format(event.getEventCompletedAt())); } - + return model; } - + /** * Adds the given username's first and last name to the given model. - * + * * @param model The model to add the first and last name to * @param userName The username of the user to lookup * @param propertyPrefix The prefix of the property name to use when adding to the model @@ -168,13 +168,13 @@ public class DispositionLifecycleGet extends DispositionAbstractBase NodeRef user = this.personService.getPerson(userName); if (user != null) { - String firstName = (String) getNodeService().getProperty(user, ContentModel.PROP_FIRSTNAME); + String firstName = (String)this.nodeService.getProperty(user, ContentModel.PROP_FIRSTNAME); if (firstName != null) { model.put(propertyPrefix + "FirstName", firstName); } - - String lastName = (String) getNodeService().getProperty(user, ContentModel.PROP_LASTNAME); + + String lastName = (String)this.nodeService.getProperty(user, ContentModel.PROP_LASTNAME); if (lastName != null) { model.put(propertyPrefix + "LastName", lastName); diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/script/RelationshipDelete.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/script/RelationshipDelete.java deleted file mode 100644 index 93237056f6..0000000000 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/script/RelationshipDelete.java +++ /dev/null @@ -1,116 +0,0 @@ -/* - * Copyright (C) 2005-2014 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - */ -package org.alfresco.module.org_alfresco_module_rm.script; - -import static org.alfresco.util.WebScriptUtils.getRequestParameterValue; -import static org.alfresco.util.WebScriptUtils.getTemplateVars; - -import java.util.HashMap; -import java.util.Map; - -import javax.servlet.http.HttpServletResponse; - -import org.alfresco.module.org_alfresco_module_rm.relationship.RelationshipService; -import org.alfresco.service.cmr.repository.NodeRef; -import org.springframework.extensions.webscripts.Cache; -import org.springframework.extensions.webscripts.Status; -import org.springframework.extensions.webscripts.WebScriptException; -import org.springframework.extensions.webscripts.WebScriptRequest; - -/** - * Implementation for Java backed webscript to delete a relationship from a node. - * - * @author Tuna Aksoy - * @since 2.3 - */ -public class RelationshipDelete extends AbstractRmWebScript -{ - /** Constants */ - private static final String STORE_TYPE = "target_store_type"; - private static final String STORE_ID = "target_store_id"; - private static final String ID = "target_id"; - private static final String UNIQUE_NAME = "uniqueName"; - - /** Relationship service */ - private RelationshipService relationshipService; - - /** - * Gets the relationship service - * - * @return The relationship service - */ - protected RelationshipService getRelationshipService() - { - return this.relationshipService; - } - - /** - * Sets the relationship service - * - * @param relationshipService The relationship service - */ - public void setRelationshipService(RelationshipService relationshipService) - { - this.relationshipService = relationshipService; - } - - /** - * @see org.springframework.extensions.webscripts.DeclarativeWebScript#executeImpl(org.springframework.extensions.webscripts.WebScriptRequest, - * org.springframework.extensions.webscripts.Status, - * org.springframework.extensions.webscripts.Cache) - */ - @Override - protected Map executeImpl(WebScriptRequest req, Status status, Cache cache) - { - String uniqueName = getRequestParameterValue(req, UNIQUE_NAME); - NodeRef source = parseRequestForNodeRef(req); - NodeRef target = parseRequestForTargetNodeRef(req); - - getRelationshipService().removeRelationship(uniqueName, source, target); - getRelationshipService().removeRelationship(uniqueName, target, source); - - Map model = new HashMap(1); - model.put(SUCCESS, true); - return model; - } - - /** - * Gets the node reference of target - * - * @param req The webscript request - * @return The node reference of the target - */ - private NodeRef parseRequestForTargetNodeRef(WebScriptRequest req) - { - Map templateVars = getTemplateVars(req); - String storeType = templateVars.get(STORE_TYPE); - String storeId = templateVars.get(STORE_ID); - String nodeId = templateVars.get(ID); - - NodeRef nodeRef = new NodeRef(storeType, storeId, nodeId); - - if (!getNodeService().exists(nodeRef)) - { - throw new WebScriptException(HttpServletResponse.SC_NOT_FOUND, "Unable to find node: '" + - nodeRef.toString() + "'."); - } - - return nodeRef; - } -} diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/script/RelationshipLabelsGet.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/script/RelationshipLabelsGet.java deleted file mode 100644 index c3850a7033..0000000000 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/script/RelationshipLabelsGet.java +++ /dev/null @@ -1,218 +0,0 @@ -/* - * Copyright (C) 2005-2014 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - */ -package org.alfresco.module.org_alfresco_module_rm.script; - -import static org.alfresco.util.ParameterCheck.mandatoryString; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.Comparator; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import org.alfresco.module.org_alfresco_module_rm.relationship.RelationshipDefinition; -import org.alfresco.module.org_alfresco_module_rm.relationship.RelationshipDisplayName; -import org.alfresco.module.org_alfresco_module_rm.relationship.RelationshipService; -import org.alfresco.module.org_alfresco_module_rm.relationship.RelationshipType; -import org.springframework.extensions.webscripts.Cache; -import org.springframework.extensions.webscripts.Status; -import org.springframework.extensions.webscripts.WebScriptException; -import org.springframework.extensions.webscripts.WebScriptRequest; - -/** - * Implementation for Java backed webscript to get the relationship labels. - * - * @author Tuna Aksoy - * @since 2.3 - */ -public class RelationshipLabelsGet extends AbstractRmWebScript -{ - /** Constants */ - private static final String RELATIONSHIP_LABELS = "relationshipLabels"; - - /** Relationship service */ - private RelationshipService relationshipService; - - /** - * Gets the relationship service - * - * @return The relationship service - */ - protected RelationshipService getRelationshipService() - { - return this.relationshipService; - } - - /** - * Sets the relationship service - * - * @param relationshipService The relationship service - */ - public void setRelationshipService(RelationshipService relationshipService) - { - this.relationshipService = relationshipService; - } - - /** - * @see org.springframework.extensions.webscripts.DeclarativeWebScript#executeImpl(org.springframework.extensions.webscripts.WebScriptRequest, - * org.springframework.extensions.webscripts.Status, - * org.springframework.extensions.webscripts.Cache) - */ - @Override - protected Map executeImpl(WebScriptRequest req, Status status, Cache cache) - { - Map model = new HashMap(1); - model.put(RELATIONSHIP_LABELS, getRelationshipsLabels()); - return model; - } - - /** - * Gets the list of available relationship labels - * - * @return The list of available relationship labels - */ - private List getRelationshipsLabels() - { - List relationshipLabels = new ArrayList(); - - Set relationshipDefinitions = getRelationshipService().getRelationshipDefinitions(); - for (RelationshipDefinition relationshipDefinition : relationshipDefinitions) - { - RelationshipType type = relationshipDefinition.getType(); - String uniqueName = relationshipDefinition.getUniqueName(); - RelationshipDisplayName displayName = relationshipDefinition.getDisplayName(); - String sourceText = displayName.getSourceText(); - String targetText = displayName.getTargetText(); - - if (RelationshipType.PARENTCHILD.equals(type)) - { - relationshipLabels.add(new RelationshipLabel(sourceText, uniqueName + INVERT)); - relationshipLabels.add(new RelationshipLabel(targetText, uniqueName)); - } - else if (RelationshipType.BIDIRECTIONAL.equals(type)) - { - if (!sourceText.equals(targetText)) - { - throw new WebScriptException( - Status.STATUS_BAD_REQUEST, - "The source '" - + sourceText - + "' and target text '" - + targetText - + "' must be the same for a bidirectional relationship."); - } - relationshipLabels.add(new RelationshipLabel(sourceText, uniqueName)); - } - else - { - throw new WebScriptException(Status.STATUS_BAD_REQUEST, "Unknown relationship type '" + type + "'."); - } - } - - return sortRelationshipLabelsByName(relationshipLabels); - } - - /** - * Helper method to sort the relationship labels by their names - * - * @param relationshipLabels Relationship labels to sort - * @return Sorted list of relationship labels - */ - private List sortRelationshipLabelsByName(List relationshipLabels) - { - Collections.sort(relationshipLabels, new Comparator() - { - @Override - public int compare(RelationshipLabel r1, RelationshipLabel r2) - { - return r1.getLabel().toLowerCase().compareTo(r2.getLabel().toLowerCase()); - } - }); - return relationshipLabels; - } - - /** - * Relationship label helper class - */ - public class RelationshipLabel - { - /** Label of the relationship */ - private String label; - - /** Unique name of the relationship */ - private String uniqueName; - - /** - * Constructor - * - * @param label Label of the relationship - * @param uniqueName Unique name of the relationship - */ - public RelationshipLabel(String label, String uniqueName) - { - mandatoryString("label", label); - mandatoryString("uniqueName", uniqueName); - - setLabel(label); - setUniqueName(uniqueName); - } - - /** - * Gets the label of the relationship - * - * @return The label of the relationship - */ - public String getLabel() - { - return this.label; - } - - /** - * Sets the label of the relationship - * - * @param label The label of the relationship - */ - private void setLabel(String label) - { - this.label = label; - } - - /** - * Gets the unique name of the relationship - * - * @return The unique name of the relationship - */ - public String getUniqueName() - { - return this.uniqueName; - } - - /** - * Sets the unique name of the relationship - * - * @param uniqueName The unique name of the relationship - */ - private void setUniqueName(String uniqueName) - { - this.uniqueName = uniqueName; - } - } -} diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/script/RelationshipsGet.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/script/RelationshipsGet.java deleted file mode 100644 index 630c9f0ddf..0000000000 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/script/RelationshipsGet.java +++ /dev/null @@ -1,184 +0,0 @@ -/* - * Copyright (C) 2005-2014 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - */ -package org.alfresco.module.org_alfresco_module_rm.script; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import org.alfresco.module.org_alfresco_module_rm.jscript.app.JSONConversionComponent; -import org.alfresco.module.org_alfresco_module_rm.relationship.Relationship; -import org.alfresco.module.org_alfresco_module_rm.relationship.RelationshipDefinition; -import org.alfresco.module.org_alfresco_module_rm.relationship.RelationshipService; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.util.WebScriptUtils; -import org.json.JSONObject; -import org.springframework.extensions.webscripts.Cache; -import org.springframework.extensions.webscripts.Status; -import org.springframework.extensions.webscripts.WebScriptException; -import org.springframework.extensions.webscripts.WebScriptRequest; - -/** - * Implementation for Java backed webscript to get the relationships for a node. - * - * @author Tuna Aksoy - * @since 2.3 - */ -public class RelationshipsGet extends AbstractRmWebScript -{ - /** Constants */ - private static final String RELATIONSHIPS = "relationships"; - private static final String RELATIONSHIP_LABEL = "relationshipLabel"; - private static final String RELATIONSHIP_UNIQUE_NAME = "relationshipUniqueName"; - - /** The relationship end point */ - private enum RelationshipEndPoint - { - SOURCE, TARGET - }; - - /** Relationship service */ - private RelationshipService relationshipService; - - /** JSON conversion component */ - private JSONConversionComponent jsonConversionComponent; - - /** - * Gets the relationship service - * - * @return The relationship service - */ - protected RelationshipService getRelationshipService() - { - return this.relationshipService; - } - - /** - * Gets the JSON conversion component - * - * @return The JSON conversion component - */ - protected JSONConversionComponent getJsonConversionComponent() - { - return this.jsonConversionComponent; - } - - /** - * Sets the relationship service - * - * @param relationshipService The relationship service - */ - public void setRelationshipService(RelationshipService relationshipService) - { - this.relationshipService = relationshipService; - } - - /** - * Sets the JSON conversion component - * - * @param jsonConversionComponent The JSON conversion component - */ - public void setJsonConversionComponent(JSONConversionComponent jsonConversionComponent) - { - this.jsonConversionComponent = jsonConversionComponent; - } - - /** - * @see org.springframework.extensions.webscripts.DeclarativeWebScript#executeImpl(org.springframework.extensions.webscripts.WebScriptRequest, - * org.springframework.extensions.webscripts.Status, - * org.springframework.extensions.webscripts.Cache) - */ - @Override - protected Map executeImpl(WebScriptRequest req, Status status, Cache cache) - { - Map model = new HashMap(1); - NodeRef nodeRef = parseRequestForNodeRef(req); - model.put(RELATIONSHIPS, getRelationships(nodeRef)); - return model; - } - - /** - * Gets the relationships of a node - * - * @param nodeRef The node reference - * - * @return The list of relationships of a node - */ - private List getRelationships(NodeRef nodeRef) - { - List relationships = new ArrayList(); - - Set relationshipsFrom = getRelationshipService().getRelationshipsFrom(nodeRef); - relationships.addAll(buildRelationshipData(relationshipsFrom, RelationshipEndPoint.TARGET)); - - Set relationshipsTo = getRelationshipService().getRelationshipsTo(nodeRef); - relationships.addAll(buildRelationshipData(relationshipsTo, RelationshipEndPoint.SOURCE)); - - return relationships; - } - - /** - * Creates the relationship data - * - * @param relationships The {@link Set} of relationships - * @param relationshipEndPoint The end point of the relationship, which is either {@link RelationshipEndpoint#SOURCE} or {@link RelationshipEndpoint#TARGET} - * @return The relationship data as {@link List} - */ - private List buildRelationshipData(Set relationships, RelationshipEndPoint relationshipEndPoint) - { - List result = new ArrayList(); - - for (Relationship relationship : relationships) - { - String uniqueName = relationship.getUniqueName(); - RelationshipDefinition relationshipDefinition = getRelationshipService().getRelationshipDefinition(uniqueName); - if (relationshipDefinition != null) - { - NodeRef node; - String label; - - if (RelationshipEndPoint.SOURCE.equals(relationshipEndPoint)) - { - node = relationship.getSource(); - label = relationshipDefinition.getDisplayName().getSourceText(); - } - else if (RelationshipEndPoint.TARGET.equals(relationshipEndPoint)) - { - node = relationship.getTarget(); - label = relationshipDefinition.getDisplayName().getTargetText(); - } - else - { - throw new WebScriptException(Status.STATUS_BAD_REQUEST, "Unknown relationship end point type '" + relationshipEndPoint + "'."); - } - - String nodeDetails = getJsonConversionComponent().toJSON(node, true); - JSONObject jsonObject = WebScriptUtils.createJSONObject(nodeDetails); - WebScriptUtils.putValuetoJSONObject(jsonObject, RELATIONSHIP_LABEL, label); - WebScriptUtils.putValuetoJSONObject(jsonObject, RELATIONSHIP_UNIQUE_NAME, relationshipDefinition.getUniqueName()); - - result.add(jsonObject.toString()); - } - } - - return result; - } -} diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/script/admin/RoleDeclarativeWebScript.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/script/admin/RoleDeclarativeWebScript.java index b1085475e4..44f9745e2c 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/script/admin/RoleDeclarativeWebScript.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/script/admin/RoleDeclarativeWebScript.java @@ -30,7 +30,7 @@ import org.alfresco.service.cmr.repository.NodeRef; import org.alfresco.service.cmr.repository.StoreRef; import org.alfresco.service.cmr.security.AuthorityService; import org.alfresco.service.cmr.security.AuthorityType; -import org.apache.commons.lang.StringUtils; +import org.apache.cxf.common.util.StringUtils; import org.springframework.extensions.webscripts.DeclarativeWebScript; import org.springframework.extensions.webscripts.WebScriptRequest; diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/script/slingshot/RMSearchGet.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/script/slingshot/RMSearchGet.java index 3313032e8a..9a48a51f75 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/script/slingshot/RMSearchGet.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/script/slingshot/RMSearchGet.java @@ -34,6 +34,7 @@ import org.alfresco.module.org_alfresco_module_rm.search.RecordsManagementSearch import org.alfresco.module.org_alfresco_module_rm.search.SavedSearchDetailsCompatibility; import org.alfresco.service.cmr.dictionary.DictionaryService; import org.alfresco.service.cmr.repository.ContentData; +import org.alfresco.service.cmr.repository.ContentService; import org.alfresco.service.cmr.repository.NodeRef; import org.alfresco.service.cmr.repository.NodeService; import org.alfresco.service.cmr.security.PermissionService; @@ -84,6 +85,9 @@ public class RMSearchGet extends DeclarativeWebScript /** Person service */ protected PersonService personService; + /** Content service */ + protected ContentService contentService; + /** Person data cache */ private Map personDataCache = null; @@ -143,6 +147,14 @@ public class RMSearchGet extends DeclarativeWebScript this.personService = personService; } + /** + * @param contentService content service + */ + public void setContentService(ContentService contentService) + { + this.contentService = contentService; + } + /* * @see org.alfresco.web.scripts.DeclarativeWebScript#executeImpl(org.alfresco.web.scripts.WebScriptRequest, org.alfresco.web.scripts.Status, org.alfresco.web.scripts.Cache) */ diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/script/slingshot/RecordedVersionConfigGet.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/script/slingshot/RecordedVersionConfigGet.java deleted file mode 100644 index d3b8eb3ee0..0000000000 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/script/slingshot/RecordedVersionConfigGet.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Copyright (C) 2005-2014 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - */ -package org.alfresco.module.org_alfresco_module_rm.script.slingshot; - -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.alfresco.module.org_alfresco_module_rm.recordableversion.RecordableVersionConfigService; -import org.alfresco.module.org_alfresco_module_rm.script.AbstractRmWebScript; -import org.alfresco.service.cmr.repository.NodeRef; -import org.springframework.extensions.webscripts.Cache; -import org.springframework.extensions.webscripts.Status; -import org.springframework.extensions.webscripts.WebScriptRequest; - -/** - * REST API to get the recorded version config for a document - * - * @author Tuna Aksoy - * @since 2.3 - */ -public class RecordedVersionConfigGet extends AbstractRmWebScript -{ - /** Recordable version config service */ - private RecordableVersionConfigService recordableVersionConfigService; - - /** - * Gets the recordable version config service - * - * @return The recordable version config service - */ - protected RecordableVersionConfigService getRecordableVersionConfigService() - { - return this.recordableVersionConfigService; - } - - /** - * Sets the recordable version config service - * - * @param recordableVersionConfigService The recordable version config service - */ - public void setRecordableVersionConfigService(RecordableVersionConfigService recordableVersionConfigService) - { - this.recordableVersionConfigService = recordableVersionConfigService; - } - - /** - * @see org.alfresco.web.scripts.DeclarativeWebScript#executeImpl(org.alfresco.web.scripts.WebScriptRequest, org.alfresco.web.scripts.Status, org.alfresco.web.scripts.Cache) - */ - @Override - protected Map executeImpl(WebScriptRequest req, Status status, Cache cache) - { - Map model = new HashMap(1); - NodeRef nodeRef = parseRequestForNodeRef(req); - List recordableVersions = getRecordableVersionConfigService().getVersions(nodeRef); - model.put("recordableVersions", recordableVersions); - return model; - } -} diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/script/slingshot/RecordedVersionConfigPost.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/script/slingshot/RecordedVersionConfigPost.java deleted file mode 100644 index 2d6a24a6cb..0000000000 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/script/slingshot/RecordedVersionConfigPost.java +++ /dev/null @@ -1,92 +0,0 @@ -/* - * Copyright (C) 2005-2014 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - */ -package org.alfresco.module.org_alfresco_module_rm.script.slingshot; - -import static org.alfresco.util.WebScriptUtils.getRequestContentAsJsonObject; -import static org.alfresco.util.WebScriptUtils.getStringValueFromJSONObject; - -import java.util.HashMap; -import java.util.Map; - -import org.alfresco.module.org_alfresco_module_rm.recordableversion.RecordableVersionConfigService; -import org.alfresco.module.org_alfresco_module_rm.script.AbstractRmWebScript; -import org.alfresco.service.cmr.repository.NodeRef; -import org.json.JSONObject; -import org.springframework.extensions.webscripts.Cache; -import org.springframework.extensions.webscripts.Status; -import org.springframework.extensions.webscripts.WebScriptRequest; - -/** - * REST API to set the recorded version config for a document - * - * @author Tuna Aksoy - * @since 2.3 - */ -public class RecordedVersionConfigPost extends AbstractRmWebScript -{ - /** Constant for recorded version parameter */ - public static final String RECORDED_VERSION = "recordedVersion"; - - /** Recordable version config service */ - private RecordableVersionConfigService recordableVersionConfigService; - - /** - * Gets the recordable version config service - * - * @return The recordable version config service - */ - protected RecordableVersionConfigService getRecordableVersionConfigService() - { - return this.recordableVersionConfigService; - } - - /** - * Sets the recordable version config service - * - * @param recordableVersionConfigService The recordable version config service - */ - public void setRecordableVersionConfigService(RecordableVersionConfigService recordableVersionConfigService) - { - this.recordableVersionConfigService = recordableVersionConfigService; - } - - /** - * @see org.alfresco.web.scripts.DeclarativeWebScript#executeImpl(org.alfresco.web.scripts.WebScriptRequest, org.alfresco.web.scripts.Status, org.alfresco.web.scripts.Cache) - */ - @Override - protected Map executeImpl(WebScriptRequest req, Status status, Cache cache) - { - NodeRef nodeRef = parseRequestForNodeRef(req); - String policy = getRecordableVersionPolicy(req); - getRecordableVersionConfigService().setVersion(nodeRef, policy); - return new HashMap(1); - } - - /** - * Gets the recordable version policy from the request - * - * @param The webscript request - * @return The recordable version policy - */ - private String getRecordableVersionPolicy(WebScriptRequest req) - { - JSONObject requestContent = getRequestContentAsJsonObject(req); - return getStringValueFromJSONObject(requestContent, RECORDED_VERSION); - } -} diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/script/slingshot/Version.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/script/slingshot/Version.java deleted file mode 100644 index 0e6f430132..0000000000 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/script/slingshot/Version.java +++ /dev/null @@ -1,92 +0,0 @@ -/* - * Copyright (C) 2005-2014 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - */ -package org.alfresco.module.org_alfresco_module_rm.script.slingshot; - -import static org.alfresco.util.ParameterCheck.mandatory; -import static org.alfresco.util.ParameterCheck.mandatoryString; - -/** - * Recordable version class - * - * @author Tuna Aksoy - * @since 2.3 - */ -public class Version -{ - /** The version policy */ - private String policy; - - /** Is the version selected */ - private boolean selected; - - /** - * Constructor - * - * @param policy The version policy - * @param selected Is the version selected - */ - public Version(String policy, boolean selected) - { - mandatoryString("policy", policy); - mandatory("selected", selected); - - setPolicy(policy); - setSelected(selected); - } - - /** - * Gets the version policy - * - * @return The version policy - */ - public String getPolicy() - { - return this.policy; - } - - /** - * Sets the version policy - * - * @param policy The version policy - */ - private void setPolicy(String policy) - { - this.policy = policy; - } - - /** - * Is the version selected - * - * @return true if the version is selected, false otherwise - */ - public boolean isSelected() - { - return this.selected; - } - - /** - * Sets the version as selected - * - * @param selected true if the version should be selected, false otherwise - */ - private void setSelected(boolean selected) - { - this.selected = selected; - } -} diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/security/ExtendedSecurityBaseDynamicAuthority.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/security/ExtendedSecurityBaseDynamicAuthority.java index 8f3cb2f44d..af1c39e600 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/security/ExtendedSecurityBaseDynamicAuthority.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/security/ExtendedSecurityBaseDynamicAuthority.java @@ -152,7 +152,7 @@ public abstract class ExtendedSecurityBaseDynamicAuthority implements DynamicAut } else { - if (getNodeService().hasAspect(nodeRef, ASPECT_EXTENDED_SECURITY)) + if (getNodeService().hasAspect(nodeRef, ASPECT_EXTENDED_SECURITY) == true) { Set authorities = getAuthorites(nodeRef); if (authorities != null) diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/security/ExtendedSecurityServiceImpl.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/security/ExtendedSecurityServiceImpl.java index 099904fa9b..61268ae7cb 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/security/ExtendedSecurityServiceImpl.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/security/ExtendedSecurityServiceImpl.java @@ -20,7 +20,6 @@ package org.alfresco.module.org_alfresco_module_rm.security; import java.io.Serializable; import java.util.HashMap; -import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Set; @@ -32,7 +31,6 @@ import org.alfresco.module.org_alfresco_module_rm.role.FilePlanRoleService; import org.alfresco.module.org_alfresco_module_rm.util.ServiceBaseImpl; import org.alfresco.service.cmr.repository.ChildAssociationRef; import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.security.AuthorityType; import org.alfresco.service.cmr.security.PermissionService; import org.alfresco.service.namespace.QName; import org.alfresco.service.namespace.RegexQNamePattern; @@ -238,24 +236,18 @@ public class ExtendedSecurityServiceImpl extends ServiceBaseImpl // get the reference count Map referenceCountMap = (Map)nodeService.getProperty(filePlan, propertyName); - // set of assigned authorities - Set assignedAuthorities = new HashSet(authorities.size()); - for (String authority : authorities) { - if ((!authority.equals(PermissionService.ALL_AUTHORITIES) && - !authority.equals(PermissionService.OWNER_AUTHORITY)) && - !AuthorityType.ROLE.equals(AuthorityType.getAuthorityType(authority)) && + if ((!authority.equals(PermissionService.ALL_AUTHORITIES) && !authority.equals(PermissionService.OWNER_AUTHORITY)) && (referenceCountMap == null || !referenceCountMap.containsKey(authority))) { // add the authority to the role filePlanRoleService.assignRoleToAuthority(filePlan, roleName, authority); - assignedAuthorities.add(authority); } } // update the reference count - nodeService.setProperty(filePlan, propertyName, (Serializable)addToMap(referenceCountMap, assignedAuthorities)); + nodeService.setProperty(filePlan, propertyName, (Serializable)addToMap(referenceCountMap, authorities)); } } diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/security/FilePlanPermissionService.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/security/FilePlanPermissionService.java index a34b4b7da5..18ff94f3e4 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/security/FilePlanPermissionService.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/security/FilePlanPermissionService.java @@ -29,9 +29,8 @@ import org.alfresco.service.cmr.repository.NodeRef; public interface FilePlanPermissionService { /** - * Setup permissions for a record category * - * @param nodeRef record category node reference + * @param nodeRef */ void setupRecordCategoryPermissions(NodeRef recordCategory); diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/security/FilePlanPermissionServiceImpl.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/security/FilePlanPermissionServiceImpl.java index 030fa5cd05..3832853292 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/security/FilePlanPermissionServiceImpl.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/security/FilePlanPermissionServiceImpl.java @@ -32,7 +32,6 @@ import java.util.Set; import org.alfresco.error.AlfrescoRuntimeException; import org.alfresco.module.org_alfresco_module_rm.capability.RMPermissionModel; -import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService; import org.alfresco.module.org_alfresco_module_rm.role.FilePlanRoleService; import org.alfresco.module.org_alfresco_module_rm.util.ServiceBaseImpl; import org.alfresco.repo.node.NodeServicePolicies; @@ -78,12 +77,6 @@ public class FilePlanPermissionServiceImpl extends ServiceBaseImpl /** Authority service */ private AuthorityService authorityService; - /** File plan role service */ - private FilePlanRoleService filePlanRoleService; - - /** File plan service */ - private FilePlanService filePlanService; - /** Logger */ private static final Log LOGGER = LogFactory.getLog(FilePlanPermissionServiceImpl.class); @@ -180,46 +173,6 @@ public class FilePlanPermissionServiceImpl extends ServiceBaseImpl this.authorityService = authorityService; } - /** - * Gets the file plan role service - * - * @return The file plan role service - */ - public FilePlanRoleService getFilePlanRoleService() - { - return this.filePlanRoleService; - } - - /** - * Sets the file plan role service - * - * @param filePlanRoleService The file plan role service to set - */ - public void setFilePlanRoleService(FilePlanRoleService filePlanRoleService) - { - this.filePlanRoleService = filePlanRoleService; - } - - /** - * Gets the file plan service - * - * @return The file plan service - */ - public FilePlanService getFilePlanService() - { - return this.filePlanService; - } - - /** - * Sets the file plan service - * - * @param filePlanService The file plan service to set - */ - public void setFilePlanService(FilePlanService filePlanService) - { - this.filePlanService = filePlanService; - } - /** * @see org.alfresco.module.org_alfresco_module_rm.security.FilePlanPermissionService#setupRecordCategoryPermissions(org.alfresco.service.cmr.repository.NodeRef) */ @@ -289,7 +242,8 @@ public class FilePlanPermissionServiceImpl extends ServiceBaseImpl ) public void onCreateHold(final ChildAssociationRef childAssocRef) { - createContainerElement(childAssocRef); + mandatory("childAssocRef", childAssocRef); + setupPermissions(childAssocRef.getParentRef(), childAssocRef.getChildRef()); } /** @@ -305,51 +259,9 @@ public class FilePlanPermissionServiceImpl extends ServiceBaseImpl notificationFrequency = TRANSACTION_COMMIT ) public void onCreateTransfer(final ChildAssociationRef childAssocRef) - { - createContainerElement(childAssocRef); - } - - /** - * Helper method to create a container element, e.g. transfer folder or hold - * - * @param childAssocRef - */ - private void createContainerElement(final ChildAssociationRef childAssocRef) { mandatory("childAssocRef", childAssocRef); - NodeRef childRef = childAssocRef.getChildRef(); - setupPermissions(childAssocRef.getParentRef(), childRef); - grantFilingPermissionToCreator(childRef); - } - - /** - * Helper method to give filing permissions to the currently logged in user who creates the node (transfer folder, hold, etc.) - * - * @param nodeRef The node reference of the created object - */ - private void grantFilingPermissionToCreator(final NodeRef nodeRef) - { - final String user = AuthenticationUtil.getFullyAuthenticatedUser(); - - final boolean hasUserPermission = authenticationUtil.runAs(new AuthenticationUtil.RunAsWork() - { - public Boolean doWork() - { - return getPermissionService().hasPermission(nodeRef, RMPermissionModel.FILING) == AccessStatus.ALLOWED; - } - }, user); - - if (!hasUserPermission) - { - authenticationUtil.runAsSystem(new AuthenticationUtil.RunAsWork() - { - public Void doWork() - { - getPermissionService().setPermission(nodeRef, user, RMPermissionModel.FILING, true); - return null; - } - }); - } + setupPermissions(childAssocRef.getParentRef(), childAssocRef.getChildRef()); } /** @@ -365,7 +277,7 @@ public class FilePlanPermissionServiceImpl extends ServiceBaseImpl if (nodeService.exists(nodeRef) && nodeService.exists(parent)) { - authenticationUtil.runAsSystem(new AuthenticationUtil.RunAsWork() + runAsSystem(new AuthenticationUtil.RunAsWork() { public Object doWork() { @@ -444,7 +356,7 @@ public class FilePlanPermissionServiceImpl extends ServiceBaseImpl mandatory("childAssocRef", record); mandatory("childAssocRef", aspectTypeQName); - authenticationUtil.runAsSystem(new AuthenticationUtil.RunAsWork() + runAsSystem(new AuthenticationUtil.RunAsWork() { public Object doWork() { @@ -470,7 +382,7 @@ public class FilePlanPermissionServiceImpl extends ServiceBaseImpl mandatory("sourceAssocRef", sourceAssocRef); mandatory("destinationAssocRef", destinationAssocRef); - authenticationUtil.runAs(new AuthenticationUtil.RunAsWork() + runAs(new AuthenticationUtil.RunAsWork() { public Void doWork() { @@ -525,7 +437,7 @@ public class FilePlanPermissionServiceImpl extends ServiceBaseImpl ParameterCheck.mandatory("authority", authority); ParameterCheck.mandatory("permission", permission); - authenticationUtil.runAsSystem(new AuthenticationUtil.RunAsWork() + runAsSystem(new AuthenticationUtil.RunAsWork() { public Void doWork() { @@ -556,7 +468,7 @@ public class FilePlanPermissionServiceImpl extends ServiceBaseImpl ParameterCheck.mandatory("authority", authority); ParameterCheck.mandatory("permission", permission); - authenticationUtil.runAsSystem(new AuthenticationUtil.RunAsWork() + runAsSystem(new AuthenticationUtil.RunAsWork() { public Void doWork() { @@ -580,7 +492,7 @@ public class FilePlanPermissionServiceImpl extends ServiceBaseImpl private boolean canPerformPermissionAction(NodeRef nodeRef) { - return isFilePlanContainer(nodeRef) || isRecordFolder(nodeRef) || isRecord(nodeRef) || isTransfer(nodeRef); + return isFilePlanContainer(nodeRef) || isRecordFolder(nodeRef) || isRecord(nodeRef); } /** diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/security/RMMethodSecurityInterceptor.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/security/RMMethodSecurityInterceptor.java index 1d4e1e5f3d..40ec0eae61 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/security/RMMethodSecurityInterceptor.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/security/RMMethodSecurityInterceptor.java @@ -39,7 +39,7 @@ public class RMMethodSecurityInterceptor extends MethodSecurityInterceptor { public String name; public AccessStatus status; - public Map conditions = new HashMap(); + public Map conditions = new HashMap(); } /** diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/transfer/TransferServiceImpl.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/transfer/TransferServiceImpl.java index 027b9d9920..4f01c4ad5c 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/transfer/TransferServiceImpl.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/transfer/TransferServiceImpl.java @@ -30,7 +30,6 @@ import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionAction; import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionActionDefinition; import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionService; import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService; -import org.alfresco.module.org_alfresco_module_rm.freeze.FreezeService; import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; import org.alfresco.module.org_alfresco_module_rm.record.RecordService; import org.alfresco.module.org_alfresco_module_rm.recordfolder.RecordFolderService; @@ -75,9 +74,6 @@ public class TransferServiceImpl extends ServiceBaseImpl /** Record folder service */ protected RecordFolderService recordFolderService; - /** Freeze Service */ - protected FreezeService freezeService; - /** * @param filePlanService file plan service */ @@ -110,14 +106,6 @@ public class TransferServiceImpl extends ServiceBaseImpl this.recordFolderService = recordFolderService; } - /** - * @param freezeService freeze service - */ - public void setFreezeService(FreezeService freezeService) - { - this.freezeService = freezeService; - } - /** * @see org.alfresco.module.org_alfresco_module_rm.transfer.TransferService#transfer(NodeRef, boolean) */ @@ -240,16 +228,6 @@ public class TransferServiceImpl extends ServiceBaseImpl List assocs = nodeService.getChildAssocs(nodeRef, ASSOC_TRANSFERRED, RegexQNamePattern.MATCH_ALL); for (ChildAssociationRef assoc : assocs) { - if(freezeService.isFrozen(assoc.getChildRef())) - { - throw new AlfrescoRuntimeException("Could not complete a transfer that contains held folders"); - } - - if(freezeService.hasFrozenChildren(assoc.getChildRef())) - { - throw new AlfrescoRuntimeException("Cound not complete a transfer that contains folders with held children"); - } - markComplete(assoc.getChildRef(), accessionIndicator, transferLocation); } diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/util/AuthenticationUtil.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/util/AuthenticationUtil.java deleted file mode 100644 index a302118b20..0000000000 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/util/AuthenticationUtil.java +++ /dev/null @@ -1,98 +0,0 @@ -/* - * Copyright (C) 2005-2014 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - */ -package org.alfresco.module.org_alfresco_module_rm.util; - -import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork; - -/** - * Helper bean to allow injection of AuthenticationUtil methods. - *

- * Useful when testing using mocks. - * - * @author Roy Wetherall - * @since 2.3 - */ -public class AuthenticationUtil -{ - /** - * Helper method that executed work as system user. - *

- * Useful when testing using mocks. - * - * @see org.alfresco.repo.security.authentication.AuthenticationUtil#runAsSystem(RunAsWork, String) - */ - public R runAsSystem(RunAsWork runAsWork) - { - return org.alfresco.repo.security.authentication.AuthenticationUtil.runAsSystem(runAsWork); - } - - /** - * Helper method that executed work as given user. - *

- * Useful when testing using mocks. - * - * @see org.alfresco.repo.security.authentication.AuthenticationUtil#runAs(RunAsWork, String) - */ - public R runAs(RunAsWork runAsWork, String uid) - { - return org.alfresco.repo.security.authentication.AuthenticationUtil.runAs(runAsWork, uid); - } - - /** - * Helper method that gets the fully authenticated user. - *

- * Useful when testing using mocks. - * - * @see org.alfresco.repo.security.authentication.AuthenticationUtil#getFullyAuthenticatedUser() - */ - public String getFullyAuthenticatedUser() - { - return org.alfresco.repo.security.authentication.AuthenticationUtil.getFullyAuthenticatedUser(); - } - - /** - * Helper method that gets the admin user name. - *

- * Useful when testing using mocks. - * - * @see org.alfresco.repo.security.authentication.AuthenticationUtil#getAdminUserName() - */ - public String getAdminUserName() - { - return org.alfresco.repo.security.authentication.AuthenticationUtil.getAdminUserName(); - } - - /** - * Helper method that gets the system user name. - * - * @see org.alfresco.repo.security.authentication.AuthenticationUtil#getSystemUserName() - */ - public String getSystemUserName() - { - return org.alfresco.repo.security.authentication.AuthenticationUtil.getSystemUserName(); - } - - /** - * @see org.alfresco.repo.security.authentication.AuthenticationUtil#isRunAsUserTheSystemUser() - */ - public boolean isRunAsUserTheSystemUser() - { - return org.alfresco.repo.security.authentication.AuthenticationUtil.isRunAsUserTheSystemUser(); - } -} diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/util/BeanExtender.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/util/BeanExtender.java new file mode 100644 index 0000000000..4e790df43e --- /dev/null +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/util/BeanExtender.java @@ -0,0 +1,102 @@ +/* + * Copyright (C) 2005-2014 Alfresco Software Limited. + * + * This file is part of Alfresco + * + * Alfresco is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Alfresco is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + */ +package org.alfresco.module.org_alfresco_module_rm.util; + +import org.alfresco.util.ParameterCheck; +import org.apache.commons.lang.StringUtils; +import org.springframework.beans.MutablePropertyValues; +import org.springframework.beans.PropertyValue; +import org.springframework.beans.factory.NoSuchBeanDefinitionException; +import org.springframework.beans.factory.config.BeanDefinition; +import org.springframework.beans.factory.config.BeanFactoryPostProcessor; +import org.springframework.beans.factory.config.ConfigurableListableBeanFactory; + +/** + * Extends the definition of a bean with another. + *

+ * Implements bean factory post processor. + * + * @author Roy Wetherall + * @since 2.2 + */ +public class BeanExtender implements BeanFactoryPostProcessor +{ + /** name of bean to extend */ + private String beanName; + + /** extending bean name */ + private String extendingBeanName; + + /** + * @param beanName bean name + */ + public void setBeanName(String beanName) + { + this.beanName = beanName; + } + + /** + * @param extendingBeanName extending bean name + */ + public void setExtendingBeanName(String extendingBeanName) + { + this.extendingBeanName = extendingBeanName; + } + + /** + * @see org.springframework.beans.factory.config.BeanFactoryPostProcessor#postProcessBeanFactory(org.springframework.beans.factory.config.ConfigurableListableBeanFactory) + */ + @Override + public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) + { + ParameterCheck.mandatory("beanName", beanName); + ParameterCheck.mandatory("extendingBeanName", extendingBeanName); + + // check for bean name + if (!beanFactory.containsBean(beanName)) + { + throw new NoSuchBeanDefinitionException("Can't find bean '" + beanName + "' to be extended."); + } + + // check for extending bean + if (!beanFactory.containsBean(extendingBeanName)) + { + throw new NoSuchBeanDefinitionException("Can't find bean '" + extendingBeanName + "' that is going to extend origional bean definition."); + } + + // get the bean definitions + BeanDefinition beanDefinition = beanFactory.getBeanDefinition(beanName); + BeanDefinition extendingBeanDefinition = beanFactory.getBeanDefinition(extendingBeanName); + + // update class + if (StringUtils.isNotBlank(extendingBeanDefinition.getBeanClassName()) && + !beanDefinition.getBeanClassName().equals(extendingBeanDefinition.getBeanClassName())) + { + beanDefinition.setBeanClassName(extendingBeanDefinition.getBeanClassName()); + } + + // update properties + MutablePropertyValues properties = beanDefinition.getPropertyValues(); + MutablePropertyValues extendingProperties = extendingBeanDefinition.getPropertyValues(); + for (PropertyValue propertyValue : extendingProperties.getPropertyValueList()) + { + properties.add(propertyValue.getName(), propertyValue.getValue()); + } + } +} diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/util/CustomPropertyEditorRegistrar.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/util/CustomPropertyEditorRegistrar.java new file mode 100644 index 0000000000..48f3cfcc45 --- /dev/null +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/util/CustomPropertyEditorRegistrar.java @@ -0,0 +1,54 @@ +/* + * Copyright (C) 2005-2014 Alfresco Software Limited. + * + * This file is part of Alfresco + * + * Alfresco is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Alfresco is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + */ +package org.alfresco.module.org_alfresco_module_rm.util; + +import org.alfresco.service.namespace.NamespaceService; +import org.alfresco.service.namespace.QName; +import org.springframework.beans.PropertyEditorRegistrar; +import org.springframework.beans.PropertyEditorRegistry; + +/** + * Custom property editor registrar. + * + * @author Roy Wetherall + * @since 2.2 + */ +public class CustomPropertyEditorRegistrar implements PropertyEditorRegistrar +{ + /** namespace service */ + private NamespaceService namespaceService; + + /** + * @param namespaceService namespace service + */ + public void setNamespaceService(NamespaceService namespaceService) + { + this.namespaceService = namespaceService; + } + + /** + * @see org.springframework.beans.PropertyEditorRegistrar#registerCustomEditors(org.springframework.beans.PropertyEditorRegistry) + */ + @Override + public void registerCustomEditors(PropertyEditorRegistry registry) + { + // add custom QName editor + registry.registerCustomEditor(QName.class, new QNameTypeEditor(namespaceService)); + } +} diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/util/AlfrescoTransactionSupport.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/util/QNameTypeEditor.java similarity index 54% rename from rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/util/AlfrescoTransactionSupport.java rename to rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/util/QNameTypeEditor.java index d2f9796300..3b7c8b16fa 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/util/AlfrescoTransactionSupport.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/util/QNameTypeEditor.java @@ -18,28 +18,37 @@ */ package org.alfresco.module.org_alfresco_module_rm.util; +import java.beans.PropertyEditorSupport; + +import org.alfresco.service.namespace.NamespaceService; +import org.alfresco.service.namespace.QName; + /** - * Alfresco Transaction Support delegation bean. - * + * QName type editor. + * * @author Roy Wetherall - * @since 2.3 - * @see org.alfresco.repo.transaction.AlfrescoTransactionSupport + * @since 2.2 */ -public class AlfrescoTransactionSupport +public class QNameTypeEditor extends PropertyEditorSupport { + /** namespace service */ + private NamespaceService namespaceService; + /** - * @see org.alfresco.repo.transaction.AlfrescoTransactionSupport#bindResource(Object, Object) + * @param namespaceService namespace service */ - public void bindResource(Object key, Object resource) + public QNameTypeEditor(NamespaceService namespaceService) { - org.alfresco.repo.transaction.AlfrescoTransactionSupport.bindResource(key, resource); + this.namespaceService = namespaceService; } - + /** - * @see org.alfresco.repo.transaction.AlfrescoTransactionSupport#unbindResource(Object) + * @see java.beans.PropertyEditorSupport#setAsText(java.lang.String) */ - public void unbindResource(Object key) + @Override + public void setAsText(String text) { - org.alfresco.repo.transaction.AlfrescoTransactionSupport.unbindResource(key); + // convert prefix string to QName + setValue(QName.createQName(text, namespaceService)); } } diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/util/ServiceBaseImpl.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/util/ServiceBaseImpl.java index 84ae926006..acee7bc40a 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/util/ServiceBaseImpl.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/util/ServiceBaseImpl.java @@ -26,8 +26,10 @@ import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanComponentKind import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService; import org.alfresco.module.org_alfresco_module_rm.hold.HoldService; import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; +import org.alfresco.repo.security.authentication.AuthenticationUtil; +import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork; +import org.alfresco.repo.transaction.TransactionalResourceHelper; import org.alfresco.service.cmr.dictionary.DictionaryService; -import org.alfresco.service.cmr.rendition.RenditionService; import org.alfresco.service.cmr.repository.ChildAssociationRef; import org.alfresco.service.cmr.repository.NodeRef; import org.alfresco.service.cmr.repository.NodeService; @@ -51,21 +53,12 @@ public class ServiceBaseImpl implements RecordsManagementModel, ApplicationConte /** Dictionary service */ protected DictionaryService dictionaryService; - /** Rendition service */ - protected RenditionService renditionService; - /** Application context */ protected ApplicationContext applicationContext; /** internal node service */ private NodeService internalNodeService; - /** authentication helper */ - protected AuthenticationUtil authenticationUtil; - - /** transactional resource helper */ - protected TransactionalResourceHelper transactionalResourceHelper; - /** * @see org.springframework.context.ApplicationContextAware#setApplicationContext(org.springframework.context.ApplicationContext) */ @@ -83,14 +76,6 @@ public class ServiceBaseImpl implements RecordsManagementModel, ApplicationConte this.nodeService = nodeService; } - /** - * @param service service - */ - public void setRenditionService(RenditionService service) - { - this.renditionService = service; - } - /** * @param dictionaryService dictionary service */ @@ -99,22 +84,6 @@ public class ServiceBaseImpl implements RecordsManagementModel, ApplicationConte this.dictionaryService = dictionaryService; } - /** - * @param authenticationUtil authentication util helper - */ - public void setAuthenticationUtil(AuthenticationUtil authenticationUtil) - { - this.authenticationUtil = authenticationUtil; - } - - /** - * @param transactionalResourceHelper transactional resource helper - */ - public void setTransactionalResourceHelper(TransactionalResourceHelper transactionalResourceHelper) - { - this.transactionalResourceHelper = transactionalResourceHelper; - } - /** * Helper to get internal node service. *

@@ -139,7 +108,7 @@ public class ServiceBaseImpl implements RecordsManagementModel, ApplicationConte { FilePlanComponentKind result = null; - Map map = transactionalResourceHelper.getMap("rm.transaction.filePlanComponentByNodeRef"); + Map map = TransactionalResourceHelper.getMap("rm.transaction.filePlanComponentByNodeRef"); if (map.containsKey(nodeRef)) { result = map.get(nodeRef); @@ -397,7 +366,7 @@ public class ServiceBaseImpl implements RecordsManagementModel, ApplicationConte NodeRef result = null; if (nodeRef != null) { - Map transactionCache = transactionalResourceHelper.getMap("rm.servicebase.getFilePlan"); + Map transactionCache = TransactionalResourceHelper.getMap("rm.servicebase.getFilePlan"); if (transactionCache.containsKey(nodeRef)) { result = transactionCache.get(nodeRef); @@ -525,4 +494,30 @@ public class ServiceBaseImpl implements RecordsManagementModel, ApplicationConte result.add(nodeService.getType(nodeRef)); return result; } + + /** + * Helper method that executed work as system user. + *

+ * Useful when testing using mocks. + * + * @param runAsWork work to execute as system user + * @return + */ + public R runAsSystem(RunAsWork runAsWork) + { + return AuthenticationUtil.runAsSystem(runAsWork); + } + + /** + * Helper method that executed work as given user. + *

+ * Useful when testing using mocks. + * + * @param runAsWork work to execute as given user + * @return + */ + public R runAs(RunAsWork runAsWork, String uid) + { + return AuthenticationUtil.runAs(runAsWork, uid); + } } diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/util/TransactionalResourceHelper.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/util/TransactionalResourceHelper.java deleted file mode 100644 index 9f62a1512d..0000000000 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/util/TransactionalResourceHelper.java +++ /dev/null @@ -1,106 +0,0 @@ -/* - * Copyright (C) 2005-2014 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - */ -package org.alfresco.module.org_alfresco_module_rm.util; - -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.TreeSet; - -/** - * Delegate spring bean for TransactionResourceHelper - * - * @author Roy Wetherall - * @since 2.3 - * @see org.alfresco.repo.transaction.TransactionalResourceHelper - */ -public class TransactionalResourceHelper -{ - /** - * @see org.alfresco.repo.transaction.TransactionalResourceHelper#getCount(Object) - */ - public int getCount(Object resourceKey) - { - return org.alfresco.repo.transaction.TransactionalResourceHelper.getCount(resourceKey); - } - - /** - * @see org.alfresco.repo.transaction.TransactionalResourceHelper#getCount(Object) - */ - public void resetCount(Object resourceKey) - { - org.alfresco.repo.transaction.TransactionalResourceHelper.resetCount(resourceKey); - } - - /** - * @see org.alfresco.repo.transaction.TransactionalResourceHelper#incrementCount(Object) - */ - public int incrementCount(Object resourceKey) - { - return org.alfresco.repo.transaction.TransactionalResourceHelper.incrementCount(resourceKey); - } - - /** - * @see org.alfresco.repo.transaction.TransactionalResourceHelper#decrementCount(Object, boolean) - */ - public int decrementCount(Object resourceKey, boolean allowNegative) - { - return org.alfresco.repo.transaction.TransactionalResourceHelper.decrementCount(resourceKey, allowNegative); - } - - /** - * @see org.alfresco.repo.transaction.TransactionalResourceHelper#getCount(Object) - */ - public boolean isResourcePresent(Object resourceKey) - { - return org.alfresco.repo.transaction.TransactionalResourceHelper.isResourcePresent(resourceKey); - } - - /** - * @see org.alfresco.repo.transaction.TransactionalResourceHelper#getMap(Object) - */ - public Map getMap(Object resourceKey) - { - return org.alfresco.repo.transaction.TransactionalResourceHelper.getMap(resourceKey); - } - - /** - * @see org.alfresco.repo.transaction.TransactionalResourceHelper#getSet(Object) - */ - public Set getSet(Object resourceKey) - { - return org.alfresco.repo.transaction.TransactionalResourceHelper.getSet(resourceKey); - } - - /** - * @see org.alfresco.repo.transaction.TransactionalResourceHelper#getTreeSet(Object) - */ - public TreeSet getTreeSet(Object resourceKey) - { - return org.alfresco.repo.transaction.TransactionalResourceHelper.getTreeSet(resourceKey); - } - - /** - * @see org.alfresco.repo.transaction.TransactionalResourceHelper#getList(Object) - */ - public List getList(Object resourceKey) - { - return org.alfresco.repo.transaction.TransactionalResourceHelper.getList(resourceKey); - } -} diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/version/RecordableVersionModel.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/version/RecordableVersionModel.java deleted file mode 100644 index f21b28043d..0000000000 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/version/RecordableVersionModel.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright (C) 2005-2014 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - */ -package org.alfresco.module.org_alfresco_module_rm.version; - -import org.alfresco.service.namespace.QName; - -/** - * Helper class containing recordable version model qualified names - * - * @author Roy Wetherall - * @since 2.3 - */ -public interface RecordableVersionModel -{ - /** Namespace details */ - String RMV_URI = "http://www.alfresco.org/model/recordableversion/1.0"; - String RMV_PREFIX = "rmv"; - - /** versionable aspect */ - QName ASPECT_VERSIONABLE = QName.createQName(RMV_URI, "versionable"); - QName PROP_RECORDABLE_VERSION_POLICY = QName.createQName(RMV_URI, "recordableVersionPolicy"); - QName PROP_FILE_PLAN = QName.createQName(RMV_URI, "filePlan"); - - /** recorded version aspect */ - QName ASPECT_RECORDED_VERSION = QName.createQName(RMV_URI, "recordedVersion"); - QName PROP_RECORD_NODE_REF = QName.createQName(RMV_URI, "recordNodeRef"); - QName PROP_FROZEN_OWNER = QName.createQName(RMV_URI, "frozenOwner"); - - /** version record aspect */ - QName ASPECT_VERSION_RECORD = QName.createQName(RMV_URI, "versionRecord"); - QName PROP_VERSIONED_NODEREF = QName.createQName(RMV_URI, "versionedNodeRef"); - QName PROP_VERSION_LABEL = QName.createQName(RMV_URI, "versionLabel"); - QName PROP_VERSION_DESCRIPTION = QName.createQName(RMV_URI, "versionDescription"); -} diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/version/RecordableVersionNodeServiceImpl.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/version/RecordableVersionNodeServiceImpl.java deleted file mode 100644 index c90dc17da9..0000000000 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/version/RecordableVersionNodeServiceImpl.java +++ /dev/null @@ -1,231 +0,0 @@ -/* - * Copyright (C) 2005-2014 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - */ -package org.alfresco.module.org_alfresco_module_rm.version; - -import static org.alfresco.module.org_alfresco_module_rm.record.RecordServiceImpl.RECORD_MODEL_URIS; - -import java.io.Serializable; -import java.util.Date; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Map; -import java.util.Set; - -import org.alfresco.model.ContentModel; -import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; -import org.alfresco.module.org_alfresco_module_rm.record.RecordService; -import org.alfresco.repo.version.Node2ServiceImpl; -import org.alfresco.repo.version.Version2Model; -import org.alfresco.repo.version.common.VersionUtil; -import org.alfresco.service.cmr.repository.InvalidNodeRefException; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.namespace.QName; - -/** - * Extended version node service implementation that supports the retrieval of - * recorded version state. - * - * @author Roy Wetherall - * @since 2.3 - */ -public class RecordableVersionNodeServiceImpl extends Node2ServiceImpl - implements RecordableVersionModel -{ - /** record service */ - private RecordService recordService; - - /** - * @param recordService record service - */ - public void setRecordService(RecordService recordService) - { - this.recordService = recordService; - } - - /** - * @see org.alfresco.repo.version.Node2ServiceImpl#getProperties(org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - public Map getProperties(NodeRef nodeRef) throws InvalidNodeRefException - { - // TODO only supported for Version2 - - NodeRef converted = VersionUtil.convertNodeRef(nodeRef); - if (dbNodeService.hasAspect(converted, ASPECT_RECORDED_VERSION)) - { - NodeRef record = (NodeRef)dbNodeService.getProperty(converted, PROP_RECORD_NODE_REF); - Map properties = dbNodeService.getProperties(record); - return processProperties(converted, properties); - } - else - { - return super.getProperties(nodeRef); - } - } - - /** - * Process properties map before returning as frozen state. - * - * @param properties properties map - * @return {@link Map}<{@link QName}, {@link Serializable}> processed property map - */ - protected Map processProperties(NodeRef version, Map properties) - { - Map cloneProperties = new HashMap(properties); - - // revert modified record name - properties.put(ContentModel.PROP_NAME, properties.get(RecordsManagementModel.PROP_ORIGIONAL_NAME)); - - // remove all rma, rmc, rmr and rmv properties - for (QName property : cloneProperties.keySet()) - { - if (!PROP_RECORDABLE_VERSION_POLICY.equals(property) && - !PROP_FILE_PLAN.equals(property) && - (recordService.isRecordMetadataProperty(property) || - RECORD_MODEL_URIS.contains(property.getNamespaceURI()))) - { - properties.remove(property); - } - } - - // do standard property processing - processVersionProperties(version, properties); - - return properties; - } - - /** - * Process version properties. - * - * @param version version node reference - * @param properties properties map - */ - protected void processVersionProperties(NodeRef version, Map properties) throws InvalidNodeRefException - { - // get version properties - Map versionProperties = dbNodeService.getProperties(version); - - if (versionProperties != null) - { - String versionLabel = (String)versionProperties.get(Version2Model.PROP_QNAME_VERSION_LABEL); - properties.put(ContentModel.PROP_VERSION_LABEL, versionLabel); - - // Convert frozen sys:referenceable properties - NodeRef nodeRef = (NodeRef)versionProperties.get(Version2Model.PROP_QNAME_FROZEN_NODE_REF); - if (nodeRef != null) - { - properties.put(ContentModel.PROP_STORE_PROTOCOL, nodeRef.getStoreRef().getProtocol()); - properties.put(ContentModel.PROP_STORE_IDENTIFIER, nodeRef.getStoreRef().getIdentifier()); - properties.put(ContentModel.PROP_NODE_UUID, nodeRef.getId()); - } - - Long dbid = (Long)versionProperties.get(Version2Model.PROP_QNAME_FROZEN_NODE_DBID); - properties.put(ContentModel.PROP_NODE_DBID, dbid); - - // Convert frozen cm:auditable properties - String creator = (String)versionProperties.get(Version2Model.PROP_QNAME_FROZEN_CREATOR); - if (creator != null) - { - properties.put(ContentModel.PROP_CREATOR, creator); - } - - Date created = (Date)versionProperties.get(Version2Model.PROP_QNAME_FROZEN_CREATED); - if (created != null) - { - properties.put(ContentModel.PROP_CREATED, created); - } - - // TODO - check use-cases for get version, revert, restore .... - String modifier = (String)versionProperties.get(Version2Model.PROP_QNAME_FROZEN_MODIFIER); - if (modifier != null) - { - properties.put(ContentModel.PROP_MODIFIER, modifier); - } - - Date modified = (Date)versionProperties.get(Version2Model.PROP_QNAME_FROZEN_MODIFIED); - if (modified != null) - { - properties.put(ContentModel.PROP_MODIFIED, modified); - } - - Date accessed = (Date)versionProperties.get(Version2Model.PROP_QNAME_FROZEN_ACCESSED); - if (accessed != null) - { - properties.put(ContentModel.PROP_ACCESSED, accessed); - } - - String owner = (String)versionProperties.get(PROP_FROZEN_OWNER); - if (owner != null) - { - properties.put(ContentModel.PROP_OWNER, owner); - } - } - } - - /** - * @see org.alfresco.repo.version.Node2ServiceImpl#getAspects(org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - public Set getAspects(NodeRef nodeRef) throws InvalidNodeRefException - { - // TODO only supported for Version2 - - NodeRef converted = VersionUtil.convertNodeRef(nodeRef); - if (dbNodeService.hasAspect(converted, ASPECT_RECORDED_VERSION)) - { - NodeRef record = (NodeRef)dbNodeService.getProperty(converted, PROP_RECORD_NODE_REF); - Set aspects = dbNodeService.getAspects(record); - return processAspects(aspects); - } - else - { - return super.getAspects(nodeRef); - } - } - - /** - * Process frozen aspects. - * - * @param aspects aspect set - * @return {@link Set}<{@link QName}> processed aspect set - */ - protected Set processAspects(Set aspects) - { - Set result = new HashSet(aspects); - - // remove version aspects - result.remove(ASPECT_VERSION); - result.remove(ASPECT_RECORDED_VERSION); - - // remove rm aspects - for (QName aspect : aspects) - { - if (!ASPECT_VERSIONABLE.equals(aspect) && - (recordService.isRecordMetadataAspect(aspect) || - RECORD_MODEL_URIS.contains(aspect.getNamespaceURI()))) - { - result.remove(aspect); - } - } - - // remove custom record meta-data aspects - - return result; - } -} diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/version/RecordableVersionService.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/version/RecordableVersionService.java deleted file mode 100755 index e5b0c8c6f2..0000000000 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/version/RecordableVersionService.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright (C) 2005-2014 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - */ -package org.alfresco.module.org_alfresco_module_rm.version; - -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.version.Version; - -/** - * Recordable version service interface. - * - * @author Roy Wetherall - * @since 2.3 - */ -public interface RecordableVersionService -{ - /** - * Indicates whether the current version of a node is recorded or not. - *

- * Returns false if not versionable or no version. - * - * @param nodeRef node reference - * @return boolean true if latest version recorded, false otherwise - */ - boolean isCurrentVersionRecorded(NodeRef nodeRef); - - /** - * Indicates whether a version is recorded or not. - * - * @param version version - * @return boolean true if recorded version, false otherwise - */ - boolean isRecordedVersion(Version version); - - /** - * Creates a record from the latest version, marking it as recorded. - *

- * Does not create a record if the node is not versionable or the latest - * version is already recorded. - * - * @param nodeRef node reference - * @return NodeRef node reference to the crated record. - */ - NodeRef createRecordFromLatestVersion(NodeRef filePlan, NodeRef nodeRef); - -} diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/version/RecordableVersionServiceImpl.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/version/RecordableVersionServiceImpl.java deleted file mode 100644 index a148fd3016..0000000000 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/version/RecordableVersionServiceImpl.java +++ /dev/null @@ -1,801 +0,0 @@ -/* - * Copyright (C) 2005-2014 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - */ -package org.alfresco.module.org_alfresco_module_rm.version; - -import static org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementCustomModel.CUSTOM_REF_VERSIONS; -import static org.codehaus.plexus.util.StringUtils.isNotBlank; - -import java.io.Serializable; -import java.util.Collection; -import java.util.Collections; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Map; -import java.util.Set; - -import org.alfresco.error.AlfrescoRuntimeException; -import org.alfresco.model.ContentModel; -import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService; -import org.alfresco.module.org_alfresco_module_rm.model.rma.type.CmObjectType; -import org.alfresco.module.org_alfresco_module_rm.model.security.ModelSecurityService; -import org.alfresco.module.org_alfresco_module_rm.record.RecordService; -import org.alfresco.module.org_alfresco_module_rm.relationship.RelationshipService; -import org.alfresco.module.org_alfresco_module_rm.security.ExtendedSecurityService; -import org.alfresco.module.org_alfresco_module_rm.util.AuthenticationUtil; -import org.alfresco.repo.policy.PolicyScope; -import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork; -import org.alfresco.repo.security.permissions.impl.ExtendedPermissionService; -import org.alfresco.repo.version.Version2Model; -import org.alfresco.repo.version.Version2ServiceImpl; -import org.alfresco.repo.version.VersionModel; -import org.alfresco.service.cmr.repository.ChildAssociationRef; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.repository.StoreRef; -import org.alfresco.service.cmr.security.OwnableService; -import org.alfresco.service.cmr.version.ReservedVersionNameException; -import org.alfresco.service.cmr.version.Version; -import org.alfresco.service.cmr.version.VersionHistory; -import org.alfresco.service.cmr.version.VersionType; -import org.alfresco.service.namespace.QName; -import org.alfresco.util.ParameterCheck; -import org.alfresco.util.PropertyMap; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -/** - * Recordable version service implementation - * - * @author Roy Wetherall - * @since 2.3 - */ -public class RecordableVersionServiceImpl extends Version2ServiceImpl - implements RecordableVersionModel, - RecordableVersionService -{ - /** share logger with version2ServiceImpl */ - private static Log logger = LogFactory.getLog(Version2ServiceImpl.class); - - /** key used to indicate a recordable version */ - public static final String KEY_RECORDABLE_VERSION = "recordable-version"; - public static final String KEY_FILE_PLAN = "file-plan"; - - /** version record property */ - public static final String PROP_VERSION_RECORD = "RecordVersion"; - - /** version aspect property names */ - private static final String[] VERSION_PROPERTY_NAMES = new String[] - { - Version2Model.PROP_CREATED_DATE, - Version2Model.PROP_VERSION_LABEL, - Version2Model.PROP_VERSION_DESCRIPTION, - - Version2Model.PROP_FROZEN_NODE_DBID, - Version2Model.PROP_FROZEN_NODE_REF, - - Version2Model.PROP_FROZEN_CREATED, - Version2Model.PROP_FROZEN_CREATOR, - Version2Model.PROP_FROZEN_MODIFIED, - Version2Model.PROP_FROZEN_MODIFIER, - Version2Model.PROP_FROZEN_ACCESSED - }; - - /** file plan service */ - private FilePlanService filePlanService; - - /** authentication util helper */ - private AuthenticationUtil authenticationUtil; - - /** relationship service */ - private RelationshipService relationshipService; - - /** record service */ - private RecordService recordService; - - /** model security service */ - private ModelSecurityService modelSecurityService; - - /** cm object type */ - private CmObjectType cmObjectType; - - /** extended permission service */ - private ExtendedPermissionService extendedPermissionService; - - /** extended security service */ - private ExtendedSecurityService extendedSecurityService; - - /** ownable service */ - private OwnableService ownableService; - - /** - * @param filePlanService file plan service - */ - public void setFilePlanService(FilePlanService filePlanService) - { - this.filePlanService = filePlanService; - } - - /** - * @param authenticationUtil authentication util helper - */ - public void setAuthenticationUtil(AuthenticationUtil authenticationUtil) - { - this.authenticationUtil = authenticationUtil; - } - - /** - * @param relationshipService relationship service - */ - public void setRelationshipService(RelationshipService relationshipService) - { - this.relationshipService = relationshipService; - } - - /** - * @param recordService record service - */ - public void setRecordService(RecordService recordService) - { - this.recordService = recordService; - } - - /** - * @param modelSecurityService model security service - */ - public void setModelSecurityService(ModelSecurityService modelSecurityService) - { - this.modelSecurityService = modelSecurityService; - } - - /** - * @param cmObjectType the cmObjectType to set - */ - public void setCmObjectType(CmObjectType cmObjectType) - { - this.cmObjectType = cmObjectType; - } - - /** - * @param extendedPermissionService extended permission service - */ - public void setExtendedPermissionService(ExtendedPermissionService extendedPermissionService) - { - this.extendedPermissionService = extendedPermissionService; - } - - /** - * @param extendedSecurityService extended security service - */ - public void setExtendedSecurityService(ExtendedSecurityService extendedSecurityService) - { - this.extendedSecurityService = extendedSecurityService; - } - - /** - * @param ownableService ownable service - */ - public void setOwnableService(OwnableService ownableService) - { - this.ownableService = ownableService; - } - - /** - * @see org.alfresco.repo.version.Version2ServiceImpl#createVersion(org.alfresco.service.cmr.repository.NodeRef, java.util.Map, int) - */ - @Override - protected Version createVersion(NodeRef nodeRef, Map origVersionProperties, int versionNumber) throws ReservedVersionNameException - { - // TODO we only support recorded versions for sub types of cm:content - - // create version properties if null - if (origVersionProperties == null) - { - origVersionProperties = new HashMap(2); - } - - // only need to check the recordable version policy when the recordable version indicator is missing from the version properties - if (!origVersionProperties.containsKey(KEY_RECORDABLE_VERSION)) - { - // get the version type - VersionType versionType = null; - if (origVersionProperties != null) - { - versionType = (VersionType)origVersionProperties.get(VersionModel.PROP_VERSION_TYPE); - } - - // determine whether this is a recorded version or not - if (isCreateRecordedVersion(nodeRef, versionType)) - { - origVersionProperties.put(KEY_RECORDABLE_VERSION, true); - if (!origVersionProperties.containsKey(KEY_FILE_PLAN)) - { - // make sure the file plan is set to the default if not specified - origVersionProperties.put(KEY_FILE_PLAN, getFilePlan(nodeRef)); - } - } - } - else - { - if (!origVersionProperties.containsKey(KEY_FILE_PLAN)) - { - // make sure the file plan is set to the default if not specified - origVersionProperties.put(KEY_FILE_PLAN, getFilePlan(nodeRef)); - } - } - - return super.createVersion(nodeRef, origVersionProperties, versionNumber); - } - - /** - * @param nodeRef node reference - * @return {@link NodeRef} associated file plan, default if none - */ - private NodeRef getFilePlan(NodeRef nodeRef) - { - NodeRef filePlan = (NodeRef)nodeService.getProperty(nodeRef, PROP_FILE_PLAN); - if (filePlan == null) - { - filePlan = getFilePlan(); - } - return filePlan; - } - - /** - * @return {@link NodeRef} default file plan, exception if none - */ - private NodeRef getFilePlan() - { - return authenticationUtil.runAsSystem(new RunAsWork() - { - @Override - public NodeRef doWork() throws Exception - { - NodeRef filePlan = filePlanService.getFilePlanBySiteId(FilePlanService.DEFAULT_RM_SITE_ID); - if (filePlan == null) - { - throw new AlfrescoRuntimeException("Can't create a recorded version, because there is no file plan."); - } - return filePlan; - } - }); - } - - /** - * Determine whether this is a recorded version or not. - * - * @param nodeRef - * @return - */ - private boolean isCreateRecordedVersion(NodeRef nodeRef, VersionType versionType) - { - boolean result = false; - if (nodeService.hasAspect(nodeRef, RecordableVersionModel.ASPECT_VERSIONABLE)) - { - String policyString = (String)nodeService.getProperty(nodeRef, PROP_RECORDABLE_VERSION_POLICY); - if (policyString != null) - { - RecordableVersionPolicy policy = RecordableVersionPolicy.valueOf(policyString.toUpperCase()); - if (RecordableVersionPolicy.ALL.equals(policy) || - (RecordableVersionPolicy.MAJOR_ONLY.equals(policy) && - VersionType.MAJOR.equals(versionType))) - { - result = true; - } - } - } - - return result; - } - - /** - * @see org.alfresco.repo.version.Version2ServiceImpl#createNewVersion(org.alfresco.service.namespace.QName, org.alfresco.service.cmr.repository.NodeRef, java.util.Map, java.util.Map, int, org.alfresco.repo.policy.PolicyScope) - */ - @Override - protected NodeRef createNewVersion( QName sourceTypeRef, - NodeRef versionHistoryRef, - Map standardVersionProperties, - Map versionProperties, - int versionNumber, - PolicyScope nodeDetails) - { - NodeRef version = null; - - if (versionProperties.containsKey(KEY_RECORDABLE_VERSION) && - ((Boolean)versionProperties.get(KEY_RECORDABLE_VERSION)).booleanValue()) - { - // create a recorded version - version = createNewRecordedVersion(sourceTypeRef, versionHistoryRef, standardVersionProperties, versionProperties, versionNumber, nodeDetails); - } - else - { - // create a normal version - version = super.createNewVersion(sourceTypeRef, versionHistoryRef, standardVersionProperties, versionProperties, versionNumber, nodeDetails); - } - - return version; - } - - /** - * Creates a new recorded version - * - * @param sourceTypeRef source type name - * @param versionHistoryRef version history reference - * @param standardVersionProperties standard version properties - * @param versionProperties version properties - * @param versionNumber version number - * @param nodeDetails policy scope - * @return {@link NodeRef} record version - */ - protected NodeRef createNewRecordedVersion(QName sourceTypeRef, - NodeRef versionHistoryRef, - Map standardVersionProperties, - Map versionProperties, - int versionNumber, - PolicyScope nodeDetails) - { - NodeRef versionNodeRef = null; - - // Disable auto-version behaviour - policyBehaviourFilter.disableBehaviour(ContentModel.ASPECT_VERSIONABLE); - - // disable other behaviours that we don't want to trigger during this process - policyBehaviourFilter.disableBehaviour(ContentModel.ASPECT_MULTILINGUAL_DOCUMENT); - policyBehaviourFilter.disableBehaviour(ContentModel.TYPE_MULTILINGUAL_CONTAINER); - - // disable model security check - modelSecurityService.disable(); - - // disable property editable check - recordService.disablePropertyEditableCheck(); - - try - { - // get the destination file plan - final NodeRef filePlan = (NodeRef)versionProperties.get(KEY_FILE_PLAN); - if (filePlan == null) - { - throw new AlfrescoRuntimeException("Can't create a new recorded version, because no file plan has been specified in the version properties."); - } - - // create a copy of the source node and place in the file plan - final NodeRef nodeRef = (NodeRef)standardVersionProperties.get(Version2Model.PROP_QNAME_FROZEN_NODE_REF); - - cmObjectType.disableCopy(); - try - { - // create record - final NodeRef record = recordService.createRecordFromCopy(filePlan, nodeRef); - - // apply version record aspect to record - PropertyMap versionRecordProps = new PropertyMap(3); - versionRecordProps.put(PROP_VERSIONED_NODEREF, nodeRef); - versionRecordProps.put(RecordableVersionModel.PROP_VERSION_LABEL, - standardVersionProperties.get( - QName.createQName(Version2Model.NAMESPACE_URI, - Version2Model.PROP_VERSION_LABEL))); - versionRecordProps.put(RecordableVersionModel.PROP_VERSION_DESCRIPTION, - standardVersionProperties.get( - QName.createQName(Version2Model.NAMESPACE_URI, - Version2Model.PROP_VERSION_DESCRIPTION))); - nodeService.addAspect(record, ASPECT_VERSION_RECORD, versionRecordProps); - - // wire record up to previous record - linkToPreviousVersionRecord(nodeRef, record); - - // create version nodeRef - ChildAssociationRef childAssocRef = dbNodeService.createNode( - versionHistoryRef, - Version2Model.CHILD_QNAME_VERSIONS, - QName.createQName(Version2Model.NAMESPACE_URI, Version2Model.CHILD_VERSIONS + "-" + versionNumber), - sourceTypeRef, - null); - versionNodeRef = childAssocRef.getChildRef(); - - // add aspect with the standard version properties to the 'version' node - nodeService.addAspect(versionNodeRef, Version2Model.ASPECT_VERSION, standardVersionProperties); - - // add the recordedVersion aspect with link to record - nodeService.addAspect(versionNodeRef, ASPECT_RECORDED_VERSION, Collections.singletonMap(PROP_RECORD_NODE_REF, (Serializable)record)); - - // freeze auditable aspect information - freezeAuditableAspect(nodeRef, versionNodeRef); - } - finally - { - cmObjectType.enableCopy(); - } - } - finally - { - // enable model security check - modelSecurityService.enable(); - - // enable property editable check - recordService.enablePropertyEditableCheck(); - - // Enable behaviours - this.policyBehaviourFilter.enableBehaviour(ContentModel.ASPECT_VERSIONABLE); - this.policyBehaviourFilter.enableBehaviour(ContentModel.ASPECT_MULTILINGUAL_DOCUMENT); - this.policyBehaviourFilter.enableBehaviour(ContentModel.TYPE_MULTILINGUAL_CONTAINER); - } - - // If the auditable aspect is not there then add it to the 'version' node (after original aspects have been frozen) - if (!dbNodeService.hasAspect(versionNodeRef, ContentModel.ASPECT_AUDITABLE)) - { - dbNodeService.addAspect(versionNodeRef, ContentModel.ASPECT_AUDITABLE, null); - } - - if (logger.isTraceEnabled()) - { - logger.trace("createNewRecordedVersion created (" + versionNumber + ") " + versionNodeRef); - } - - return versionNodeRef; - } - - /** - * Helper method to link the record to the previous version record - * - * @param nodeRef noderef source node reference - * @param record record record node reference - */ - private void linkToPreviousVersionRecord(final NodeRef nodeRef, final NodeRef record) - { - final NodeRef latestRecordVersion = getLatestVersionRecord(nodeRef); - if (latestRecordVersion != null) - { - authenticationUtil.runAsSystem(new RunAsWork() - { - @Override - public Void doWork() throws Exception - { - // indicate that the new record versions the previous record - relationshipService.addRelationship(CUSTOM_REF_VERSIONS.getLocalName(), record, latestRecordVersion); - return null; - } - }); - } - } - - /** - * Helper to get the latest version record for a given document (ie non-record) - * - * @param nodeRef node reference - * @return NodeRef latest version record, null otherwise - */ - private NodeRef getLatestVersionRecord(NodeRef nodeRef) - { - NodeRef versionRecord = null; - - // wire record up to previous record - VersionHistory versionHistory = getVersionHistory(nodeRef); - if (versionHistory != null) - { - Collection previousVersions = versionHistory.getAllVersions(); - for (Version previousVersion : previousVersions) - { - // look for the associated record - final NodeRef previousRecord = (NodeRef)previousVersion.getVersionProperties().get(PROP_VERSION_RECORD); - if (previousRecord != null) - { - versionRecord = previousRecord; - break; - } - } - } - - return versionRecord; - } - - /** - * Freezes audit aspect properties. - * - * @param nodeRef - * @param versionNodeRef - */ - private void freezeAuditableAspect(NodeRef nodeRef, NodeRef versionNodeRef) - { - if (nodeService.hasAspect(nodeRef, ContentModel.ASPECT_AUDITABLE)) - { - Map properties = dbNodeService.getProperties(nodeRef); - dbNodeService.setProperty(versionNodeRef, Version2Model.PROP_QNAME_FROZEN_CREATOR, properties.get(ContentModel.PROP_CREATOR)); - dbNodeService.setProperty(versionNodeRef, Version2Model.PROP_QNAME_FROZEN_CREATED, properties.get(ContentModel.PROP_CREATED)); - dbNodeService.setProperty(versionNodeRef, Version2Model.PROP_QNAME_FROZEN_MODIFIER, properties.get(ContentModel.PROP_MODIFIER)); - dbNodeService.setProperty(versionNodeRef, Version2Model.PROP_QNAME_FROZEN_MODIFIED, properties.get(ContentModel.PROP_MODIFIED)); - dbNodeService.setProperty(versionNodeRef, Version2Model.PROP_QNAME_FROZEN_ACCESSED, properties.get(ContentModel.PROP_ACCESSED)); - if (properties.get(ContentModel.PROP_OWNER) != null) - { - dbNodeService.setProperty(versionNodeRef, PROP_FROZEN_OWNER, properties.get(ContentModel.PROP_OWNER)); - } - } - } - - /** - * @see org.alfresco.repo.version.Version2ServiceImpl#getVersion(org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - protected Version getVersion(NodeRef versionRef) - { - Version version = super.getVersion(versionRef); - - NodeRef record = (NodeRef)dbNodeService.getProperty(versionRef, PROP_RECORD_NODE_REF); - if (record != null) - { - version.getVersionProperties().put(PROP_VERSION_RECORD, record); - } - - return version; - } - - /** - * @see org.alfresco.repo.version.Version2ServiceImpl#revert(org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.cmr.version.Version, boolean) - */ - @Override - public void revert(NodeRef nodeRef, Version version, boolean deep) - { - String versionPolicy = (String) dbNodeService.getProperty(nodeRef, PROP_RECORDABLE_VERSION_POLICY); - - super.revert(nodeRef, version, deep); - - if (isNotBlank(versionPolicy)) - { - dbNodeService.setProperty(nodeRef, PROP_RECORDABLE_VERSION_POLICY, versionPolicy); - } - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.version.RecordableVersionService#isLatestVersionRecorded(org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - public boolean isCurrentVersionRecorded(NodeRef nodeRef) - { - boolean result = false; - Version version = getCurrentVersion(nodeRef); - if (version != null) - { - result = isRecordedVersion(version); - } - return result; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.version.RecordableVersionService#isRecordedVersion(org.alfresco.service.cmr.version.Version) - */ - @Override - public boolean isRecordedVersion(Version version) - { - boolean result = true; - if (version.getVersionProperties().get(PROP_VERSION_RECORD) == null) - { - result = false; - } - return result; - } - - /** - * Create Version Store Ref - * - * @param store ref - * @return store ref for version store - */ - public StoreRef convertStoreRef(StoreRef storeRef) - { - return new StoreRef(StoreRef.PROTOCOL_WORKSPACE, storeRef.getIdentifier()); - } - - /** - * Convert the incomming node ref (with the version store protocol specified) - * to the internal representation with the workspace protocol. - * - * @param nodeRef the incomming verison protocol node reference - * @return the internal version node reference - */ - public NodeRef convertNodeRef(NodeRef nodeRef) - { - return new NodeRef(convertStoreRef(nodeRef.getStoreRef()), nodeRef.getId()); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.version.RecordableVersionService#createRecordFromLatestVersion(org.alfresco.service.cmr.repository.NodeRef, org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - public NodeRef createRecordFromLatestVersion(final NodeRef filePlan, final NodeRef nodeRef) - { - ParameterCheck.mandatory("filePlan", filePlan); - ParameterCheck.mandatory("nodeRef", nodeRef); - - NodeRef record = null; - - // check for versionable aspect - if (nodeService.hasAspect(nodeRef, ContentModel.ASPECT_VERSIONABLE)) - { - // get the latest version - final Version currentVersion = getCurrentVersion(nodeRef); - - if (currentVersion != null && - !isRecordedVersion(currentVersion)) - { - // create the record from the current frozen state - record = authenticationUtil.runAsSystem(new RunAsWork() - { - public NodeRef doWork() throws Exception - { - // get the documents readers - Long aclId = nodeService.getNodeAclId(nodeRef); - Set readers = extendedPermissionService.getReaders(aclId); - Set writers = extendedPermissionService.getWriters(aclId); - - // add the current owner to the list of extended writers - String owner = ownableService.getOwner(nodeRef); - - // grab the frozen state - NodeRef currentFrozenState = currentVersion.getFrozenStateNodeRef(); - - // determine the type of the object - QName type = nodeService.getType(currentFrozenState); - - // grab all the properties - Map properties = nodeService.getProperties(currentFrozenState); - - // grab all the aspects - Set aspects = nodeService.getAspects(currentFrozenState); - - // create the record - NodeRef record = recordService.createRecordFromContent( - filePlan, - (String)properties.get(ContentModel.PROP_NAME), - type, - properties, - null); - - // apply aspects to record - for (QName aspect : aspects) - { - // add the aspect, properties have already been set - nodeService.addAspect(record, aspect, null); - } - - // apply version record aspect to record - PropertyMap versionRecordProps = new PropertyMap(3); - versionRecordProps.put(PROP_VERSIONED_NODEREF, nodeRef); - versionRecordProps.put(RecordableVersionModel.PROP_VERSION_LABEL, currentVersion.getVersionLabel()); - versionRecordProps.put(RecordableVersionModel.PROP_VERSION_DESCRIPTION, currentVersion.getDescription()); - nodeService.addAspect(record, ASPECT_VERSION_RECORD, versionRecordProps); - - // wire record up to previous record - linkToPreviousVersionRecord(nodeRef, record); - - // set the extended security - Set combinedWriters = new HashSet(writers); - if (owner != null && !owner.isEmpty() && !owner.equals(OwnableService.NO_OWNER)) - { - combinedWriters.add(owner); - } - combinedWriters.add(authenticationUtil.getFullyAuthenticatedUser()); - extendedSecurityService.addExtendedSecurity(record, readers, combinedWriters); - - return record; - } - }); - - // get the version history - NodeRef versionHistoryRef = getVersionHistoryNodeRef(nodeRef); - - // get details from the version before we remove it - int versionNumber = getVersionNumber(currentVersion); - Map versionProperties = getVersionAspectProperties(currentVersion); - QName sourceTypeRef = getVersionType(currentVersion); - - // patch-up owner information, which needs to be frozen for recorded versions - String owner = (String)nodeService.getProperty(currentVersion.getFrozenStateNodeRef(), ContentModel.PROP_OWNER); - if (owner != null) - { - versionProperties.put(PROP_FROZEN_OWNER, owner); - } - - // delete the current version - this.dbNodeService.deleteNode(convertNodeRef(currentVersion.getFrozenStateNodeRef())); - - // create a new version history if we need to - if (!nodeService.exists(versionHistoryRef)) - { - versionHistoryRef = createVersionHistory(nodeRef); - } - - // create recorded version nodeRef - ChildAssociationRef childAssocRef = dbNodeService.createNode( - versionHistoryRef, - Version2Model.CHILD_QNAME_VERSIONS, - QName.createQName(Version2Model.NAMESPACE_URI, Version2Model.CHILD_VERSIONS + "-" + versionNumber), - sourceTypeRef, - null); - NodeRef versionNodeRef = childAssocRef.getChildRef(); - - // add aspect with the standard version properties to the 'version' node - nodeService.addAspect(versionNodeRef, Version2Model.ASPECT_VERSION, versionProperties); - - // add the recordedVersion aspect with link to record - nodeService.addAspect(versionNodeRef, ASPECT_RECORDED_VERSION, Collections.singletonMap(PROP_RECORD_NODE_REF, (Serializable)record)); - } - } - - return record; - } - - /** - * Helper method to get the version number of a given version by inspecting the - * name of the parent association. - * - * @param version version - * @return int version number - */ - private int getVersionNumber(Version version) - { - NodeRef versionNodeRef = getVersionNodeRef(version); - ChildAssociationRef assoc = dbNodeService.getPrimaryParent(versionNodeRef); - String fullVersionNumber = assoc.getQName().getLocalName(); - String versionNumber = fullVersionNumber.substring(fullVersionNumber.indexOf("-") + 1); - return Integer.parseInt(versionNumber); - } - - /** - * Helper method to get all the version aspect properties from an existing version - * - * @param version version - * @return Map property values - */ - private Map getVersionAspectProperties(Version version) - { - NodeRef versionNodeRef = getVersionNodeRef(version); - Map versionProps = dbNodeService.getProperties(versionNodeRef); - Map result = new HashMap(9); - for (String propertyName : VERSION_PROPERTY_NAMES) - { - QName propertyQName = QName.createQName(Version2Model.NAMESPACE_URI, propertyName); - result.put(propertyQName, versionProps.get(propertyQName)); - - if (propertyName.equals(Version2Model.PROP_FROZEN_NODE_DBID)) - { - System.out.println(versionProps.get(propertyQName)); - } - } - return result; - } - - /** - * Helper method to get the type of a versions frozen state - * - * @param currentVersion - * @return - */ - private QName getVersionType(Version version) - { - return nodeService.getType(getVersionNodeRef(version)); - } - - /** - * Helper method to get the internal node reference of a version - * - * @param version version - * @return NodeRef internal node reference to version - */ - private NodeRef getVersionNodeRef(Version version) - { - return convertNodeRef(version.getFrozenStateNodeRef()); - } -} diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/version/model/VersionableAspect.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/version/model/VersionableAspect.java deleted file mode 100644 index b8d6a51e30..0000000000 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/version/model/VersionableAspect.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright (C) 2005-2014 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - */ -package org.alfresco.module.org_alfresco_module_rm.version.model; - -import org.alfresco.module.org_alfresco_module_rm.model.BaseBehaviourBean; -import org.alfresco.repo.copy.CopyBehaviourCallback; -import org.alfresco.repo.copy.CopyDetails; -import org.alfresco.repo.copy.DoNothingCopyBehaviourCallback; -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.namespace.QName; - -/** - * rmv:versionsable aspect behaviour bean implementation - * - * @author Roy Wetherall - * @since 2.3 - */ -@BehaviourBean -( - defaultType="rmv:versionable" -) -public class VersionableAspect extends BaseBehaviourBean -{ - /** - * Copy callback. - * - * Cutoff aspect should not be copied. - */ - @Behaviour - ( - kind = BehaviourKind.CLASS, - policy = "alf:getCopyCallback" - ) - public CopyBehaviourCallback getCopyCallback(QName classRef, CopyDetails copyDetails) - { - return new DoNothingCopyBehaviourCallback(); - } -} diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/vital/BroadcastVitalRecordDefinitionAction.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/vital/BroadcastVitalRecordDefinitionAction.java index b7957d7b71..74d199459b 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/vital/BroadcastVitalRecordDefinitionAction.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/vital/BroadcastVitalRecordDefinitionAction.java @@ -78,7 +78,7 @@ public class BroadcastVitalRecordDefinitionAction extends RMActionExecuterAbstra */ private void propagateChangeToChildrenOf(NodeRef actionedUponNodeRef) { - Map parentProps = getNodeService().getProperties(actionedUponNodeRef); + Map parentProps = nodeService.getProperties(actionedUponNodeRef); // parent vital record indicator, default to null if not set boolean parentVri = false; @@ -90,41 +90,41 @@ public class BroadcastVitalRecordDefinitionAction extends RMActionExecuterAbstra Period parentReviewPeriod = (Period) parentProps.get(PROP_REVIEW_PERIOD); - List assocs = this.getNodeService().getChildAssocs(actionedUponNodeRef, ContentModel.ASSOC_CONTAINS, RegexQNamePattern.MATCH_ALL); + List assocs = this.nodeService.getChildAssocs(actionedUponNodeRef, ContentModel.ASSOC_CONTAINS, RegexQNamePattern.MATCH_ALL); for (ChildAssociationRef nextAssoc : assocs) { NodeRef nextChild = nextAssoc.getChildRef(); if (filePlanService.isFilePlanComponent(nextChild) && - !getFreezeService().isFrozen(nextChild)) + !freezeService.isFrozen(nextChild)) { // If the child is a record, then the VitalRecord aspect needs to be applied or updated - if (getRecordService().isRecord(nextChild)) + if (recordService.isRecord(nextChild)) { if (parentVri) { - VitalRecordDefinition vrDefn = getVitalRecordService().getVitalRecordDefinition(nextChild); + VitalRecordDefinition vrDefn = vitalRecordService.getVitalRecordDefinition(nextChild); Map aspectProps = new HashMap(); aspectProps.put(PROP_REVIEW_AS_OF, vrDefn.getNextReviewDate()); - getNodeService().addAspect(nextChild, RecordsManagementModel.ASPECT_VITAL_RECORD, aspectProps); + nodeService.addAspect(nextChild, RecordsManagementModel.ASPECT_VITAL_RECORD, aspectProps); } else { - getNodeService().removeAspect(nextChild, RecordsManagementModel.ASPECT_VITAL_RECORD); + nodeService.removeAspect(nextChild, RecordsManagementModel.ASPECT_VITAL_RECORD); } } else // copy the vitalRecordDefinition properties from the parent to the child { - Map childProps = getNodeService().getProperties(nextChild); + Map childProps = nodeService.getProperties(nextChild); childProps.put(PROP_REVIEW_PERIOD, parentReviewPeriod); childProps.put(PROP_VITAL_RECORD_INDICATOR, parentVri); - getNodeService().setProperties(nextChild, childProps); + nodeService.setProperties(nextChild, childProps); } // Recurse down the containment hierarchy to all containers - if (!getRecordService().isRecord(nextChild)) + if (!recordService.isRecord(nextChild)) { this.propagateChangeToChildrenOf(nextChild); } diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/vital/ReviewedAction.java b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/vital/ReviewedAction.java index 7f3b517f26..79c4633567 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/vital/ReviewedAction.java +++ b/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/vital/ReviewedAction.java @@ -43,16 +43,16 @@ public class ReviewedAction extends RMActionExecuterAbstractBase @Override protected void executeImpl(Action action, NodeRef actionedUponNodeRef) { - VitalRecordDefinition vrDef = getVitalRecordService().getVitalRecordDefinition(actionedUponNodeRef); + VitalRecordDefinition vrDef = vitalRecordService.getVitalRecordDefinition(actionedUponNodeRef); if (vrDef != null && vrDef.isEnabled()) { - if (getRecordService().isRecord(actionedUponNodeRef)) + if (recordService.isRecord(actionedUponNodeRef)) { reviewRecord(actionedUponNodeRef, vrDef); } - else if (getRecordFolderService().isRecordFolder(actionedUponNodeRef)) + else if (recordFolderService.isRecordFolder(actionedUponNodeRef)) { - for (NodeRef record : getRecordService().getRecords(actionedUponNodeRef)) + for (NodeRef record : recordService.getRecords(actionedUponNodeRef)) { reviewRecord(record, vrDef); } @@ -83,7 +83,7 @@ public class ReviewedAction extends RMActionExecuterAbstractBase logger.debug(msg.toString()); } - this.getNodeService().setProperty(nodeRef, PROP_REVIEW_AS_OF, reviewAsOf); + this.nodeService.setProperty(nodeRef, PROP_REVIEW_AS_OF, reviewAsOf); //TODO And record previous review date, time, user } } diff --git a/rm-server/source/java/org/alfresco/repo/action/parameter/DateParameterProcessor.java b/rm-server/source/java/org/alfresco/repo/action/parameter/DateParameterProcessor.java index 1c475bc5bd..e8c61e95e0 100644 --- a/rm-server/source/java/org/alfresco/repo/action/parameter/DateParameterProcessor.java +++ b/rm-server/source/java/org/alfresco/repo/action/parameter/DateParameterProcessor.java @@ -221,8 +221,7 @@ public class DateParameterProcessor extends ParameterProcessor implements Parame String namePrefix = this.getName() + "."; if(StringUtils.isBlank(substitutionFragment) || this.getName().toLowerCase().contains(substitutionFragment.toLowerCase())) { - for(String field: ALL_FIELDS_FOR_SUBSTITUTION_QUERY) - { + for(String field: ALL_FIELDS_FOR_SUBSTITUTION_QUERY) { suggestions.add(namePrefix + field); if(suggestions.size() >= maximumNumberSuggestions) { @@ -232,8 +231,7 @@ public class DateParameterProcessor extends ParameterProcessor implements Parame } else { - for(String field: ALL_FIELDS_FOR_SUBSTITUTION_QUERY) - { + for(String field: ALL_FIELDS_FOR_SUBSTITUTION_QUERY) { String prefixFieldName = namePrefix + field; if(prefixFieldName.toLowerCase().contains(substitutionFragment.toLowerCase())) { diff --git a/rm-server/source/java/org/alfresco/repo/policy/annotation/AnnotatedBehaviourPostProcessor.java b/rm-server/source/java/org/alfresco/repo/policy/annotation/AnnotatedBehaviourPostProcessor.java new file mode 100644 index 0000000000..9b40a76b11 --- /dev/null +++ b/rm-server/source/java/org/alfresco/repo/policy/annotation/AnnotatedBehaviourPostProcessor.java @@ -0,0 +1,257 @@ +/* + * Copyright (C) 2005-2014 Alfresco Software Limited. + * + * This file is part of Alfresco + * + * Alfresco is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Alfresco is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + */ +package org.alfresco.repo.policy.annotation; + +import java.lang.reflect.Method; + +import org.alfresco.repo.policy.JavaBehaviour; +import org.alfresco.repo.policy.PolicyComponent; +import org.alfresco.service.namespace.NamespaceService; +import org.alfresco.service.namespace.QName; +import org.alfresco.util.ParameterCheck; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.springframework.beans.factory.config.BeanPostProcessor; + +/** + * Annotated behaviour bean post processor. + *

+ * Registers the annotated methods on behaviour beans with the policy component. + * + * @author Roy Wetherall + */ +public class AnnotatedBehaviourPostProcessor implements BeanPostProcessor +{ + /** logger */ + private static Log logger = LogFactory.getLog(AnnotatedBehaviourPostProcessor.class); + + /** policy component */ + private PolicyComponent policyComponent; + + /** namespace service */ + private NamespaceService namespaceService; + + /** + * @param policyComponent policy component + */ + public void setPolicyComponent(PolicyComponent policyComponent) + { + this.policyComponent = policyComponent; + } + + /** + * @param namespaceService namespace service + */ + public void setNamespaceService(NamespaceService namespaceService) + { + this.namespaceService = namespaceService; + } + + /** + * @see org.springframework.beans.factory.config.BeanPostProcessor#postProcessAfterInitialization(java.lang.Object, java.lang.String) + */ + @Override + public Object postProcessAfterInitialization(Object bean, String beanName) + { + // register annotated behavior methods + registerBehaviours(bean, beanName); + + // return the bean + return bean; + } + + /** + * @see org.springframework.beans.factory.config.BeanPostProcessor#postProcessBeforeInitialization(java.lang.Object, java.lang.String) + */ + @Override + public Object postProcessBeforeInitialization(Object bean, String beanName) + { + // do nothing + return bean; + } + + /** + * Register behaviours. + * + * @param bean bean + * @param beanName bean name + */ + private void registerBehaviours(Object bean, String beanName) + { + if (bean.getClass().isAnnotationPresent(BehaviourBean.class)) + { + BehaviourBean behaviourBean = bean.getClass().getAnnotation(BehaviourBean.class); + + if (logger.isDebugEnabled()) + { + logger.debug("Annotated behaviour post processing for " + beanName); + } + + Method[] methods = bean.getClass().getMethods(); + for (Method method : methods) + { + if (method.isAnnotationPresent(Behaviour.class)) + { + registerBehaviour(behaviourBean, bean, beanName, method); + } + } + } + } + + /** + * Register behaviour. + * + * @param behaviourBean behaviour bean annotation + * @param bean bean + * @param beanName bean name + * @param method method + */ + private void registerBehaviour(BehaviourBean behaviourBean, Object bean, String beanName, Method method) + { + Behaviour behaviour = method.getAnnotation(Behaviour.class); + QName policy = resolvePolicy(behaviour.policy(), method); + QName type = resolveType(behaviourBean, behaviour); + + // assert that the policy and type have been set!! + ParameterCheck.mandatory("policy", policy); + if (!behaviour.isService()) + { + ParameterCheck.mandatory("type", type); + } + + if (logger.isDebugEnabled()) + { + if (!behaviour.isService()) + { + logger.debug(" ... binding " + behaviour.kind() + " behaviour for " + beanName + "." + method.getName() + + " for policy " + policy.toString() + + " and type " + type.toString()); + } + else + { + logger.debug(" ... binding " + behaviour.kind() + " service behaviour for " + beanName + "." + method.getName() + + " for policy " + policy.toString()); + } + } + + // create java behaviour object + JavaBehaviour javaBehaviour = new JavaBehaviour(bean, method.getName(), behaviour.notificationFrequency()); + + // determine whether we should register the behaviour + if (bean instanceof BehaviourRegistry && !behaviour.name().isEmpty()) + { + if (logger.isDebugEnabled()) + { + logger.debug(" ... adding behaviour to registry with name " + behaviour.name()); + } + + ((BehaviourRegistry)bean).registerBehaviour(behaviour.name(), javaBehaviour); + } + + // deal with class behaviours + if (BehaviourKind.CLASS.equals(behaviour.kind())) + { + if (!behaviour.isService()) + { + // bind class behaviour for given type + policyComponent.bindClassBehaviour(policy, type, javaBehaviour); + } + else + { + // bind class service behaviour + policyComponent.bindClassBehaviour(policy, bean, javaBehaviour); + } + } + // deal with association behaviours + else if (BehaviourKind.ASSOCIATION.equals(behaviour.kind())) + { + if (!behaviour.isService()) + { + // bind association behaviour for given type and assoc type + policyComponent.bindAssociationBehaviour(policy, + type, + toQName(behaviour.assocType()), + javaBehaviour); + } + else + { + // bind association service behaviour + policyComponent.bindAssociationBehaviour(policy, bean, javaBehaviour); + } + } + } + + /** + * Resolve the policy qname, defaulting to the qualified name of the method if none specified. + * + * @param policyName policy name + * @param method method + * @return {@link QName} qualified name of the policy + */ + private QName resolvePolicy(String policyName, Method method) + { + QName policy = null; + if (policyName.isEmpty()) + { + policy = QName.createQName(NamespaceService.ALFRESCO_URI, method.getName()); + } + else + { + policy = toQName(policyName); + } + + return policy; + } + + /** + * + * @param behaviourBean + * @param typeName + * @return + */ + private QName resolveType(BehaviourBean behaviourBean, Behaviour behaviour) + { + QName type = null; + if (!behaviour.isService()) + { + if (behaviour.type().isEmpty()) + { + // get default + type = toQName(behaviourBean.defaultType()); + } + else + { + // convert set + type = toQName(behaviour.type()); + } + } + return type; + } + + /** + * + * @param name + * @return + */ + private QName toQName(String name) + { + return QName.createQName(name, namespaceService); + } + +} diff --git a/rm-server/source/java/org/alfresco/repo/policy/annotation/Behaviour.java b/rm-server/source/java/org/alfresco/repo/policy/annotation/Behaviour.java new file mode 100644 index 0000000000..95a419c87a --- /dev/null +++ b/rm-server/source/java/org/alfresco/repo/policy/annotation/Behaviour.java @@ -0,0 +1,57 @@ +/* + * Copyright (C) 2005-2014 Alfresco Software Limited. + * + * This file is part of Alfresco + * + * Alfresco is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Alfresco is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + */ +package org.alfresco.repo.policy.annotation; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +import org.alfresco.repo.policy.Behaviour.NotificationFrequency; + +/** + * Behaviour method annotation. + * + * @author Roy Wetherall + */ +@Target(value = ElementType.METHOD) +@Retention(value = RetentionPolicy.RUNTIME) +public @interface Behaviour +{ + /** lookup name of the behaviour, if none specified behaviour is not recorded in the registry */ + String name() default ""; + + /** kind of behaviour */ + BehaviourKind kind(); + + /** qualified name of policy */ + String policy() default ""; + + /** indicates whether this is a service behaviour or not */ + boolean isService() default false; + + /** qualified name of type/aspect */ + String type() default ""; + + /** qualified name of association */ + String assocType() default "cm:contains"; + + /** notification frequency */ + NotificationFrequency notificationFrequency() default NotificationFrequency.EVERY_EVENT; +} diff --git a/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/relationship/RelationshipTestSuite.java b/rm-server/source/java/org/alfresco/repo/policy/annotation/BehaviourBean.java old mode 100755 new mode 100644 similarity index 64% rename from rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/relationship/RelationshipTestSuite.java rename to rm-server/source/java/org/alfresco/repo/policy/annotation/BehaviourBean.java index fd06625cfb..ecc859b182 --- a/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/relationship/RelationshipTestSuite.java +++ b/rm-server/source/java/org/alfresco/repo/policy/annotation/BehaviourBean.java @@ -16,24 +16,21 @@ * You should have received a copy of the GNU Lesser General Public License * along with Alfresco. If not, see . */ -package org.alfresco.module.org_alfresco_module_rm.test.integration.relationship; +package org.alfresco.repo.policy.annotation; -import org.junit.runner.RunWith; -import org.junit.runners.Suite; -import org.junit.runners.Suite.SuiteClasses; +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; /** - * Relationship integration test suite - * * @author Roy Wetherall - * @since 2.3 */ -@RunWith(Suite.class) -@SuiteClasses( -{ - CreateRelationshipTest.class, - DeleteRelationshipTest.class -}) -public class RelationshipTestSuite +@Target(value = ElementType.TYPE) +@Retention(value = RetentionPolicy.RUNTIME) +public @interface BehaviourBean { + /** qualified name of type/aspect */ + String defaultType() default ""; + } diff --git a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/version/RecordableVersionPolicy.java b/rm-server/source/java/org/alfresco/repo/policy/annotation/BehaviourKind.java similarity index 79% rename from rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/version/RecordableVersionPolicy.java rename to rm-server/source/java/org/alfresco/repo/policy/annotation/BehaviourKind.java index ec730d4909..ab04b779cb 100644 --- a/rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/version/RecordableVersionPolicy.java +++ b/rm-server/source/java/org/alfresco/repo/policy/annotation/BehaviourKind.java @@ -16,15 +16,16 @@ * You should have received a copy of the GNU Lesser General Public License * along with Alfresco. If not, see . */ -package org.alfresco.module.org_alfresco_module_rm.version; +package org.alfresco.repo.policy.annotation; /** + * Enumeration describing the different kinds of behaviour. + * * @author Roy Wetherall - * @since 2.3 + * @since 2.2 */ -public enum RecordableVersionPolicy +public enum BehaviourKind { - NONE, - MAJOR_ONLY, - ALL + CLASS, + ASSOCIATION } diff --git a/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/version/VersionTestSuite.java b/rm-server/source/java/org/alfresco/repo/policy/annotation/BehaviourRegistry.java old mode 100644 new mode 100755 similarity index 56% rename from rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/version/VersionTestSuite.java rename to rm-server/source/java/org/alfresco/repo/policy/annotation/BehaviourRegistry.java index c2d39cf2b6..bab4d573f8 --- a/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/version/VersionTestSuite.java +++ b/rm-server/source/java/org/alfresco/repo/policy/annotation/BehaviourRegistry.java @@ -16,25 +16,30 @@ * You should have received a copy of the GNU Lesser General Public License * along with Alfresco. If not, see . */ -package org.alfresco.module.org_alfresco_module_rm.test.integration.version; +package org.alfresco.repo.policy.annotation; -import org.junit.runner.RunWith; -import org.junit.runners.Suite; -import org.junit.runners.Suite.SuiteClasses; +import org.alfresco.repo.policy.Behaviour; /** - * Recordable Version Test Suite + * Interface for a behaviour registry. * * @author Roy Wetherall - * @since 2.3 + * @since 2.2 */ -@RunWith(Suite.class) -@SuiteClasses( -{ - AdHocRecordableVersionsTest.class, - AutoRecordableVersionsTest.class, - DeclareAsRecordVersionTest.class -}) -public class VersionTestSuite +public interface BehaviourRegistry { + /** + * Register a behaviour against a given name. + * + * @param behaviour behaviour + */ + void registerBehaviour(String name, Behaviour behaviour); + + /** + * Gets the behaviour for a given name. + * + * @param name behaviour name + * @return {@link Behaviour} behaviour, null otherwise + */ + Behaviour getBehaviour(String name); } diff --git a/rm-server/source/java/org/alfresco/repo/security/permissions/impl/RMPermissionServiceImpl.java b/rm-server/source/java/org/alfresco/repo/security/permissions/impl/RMPermissionServiceImpl.java index e01c1be439..580bc883ad 100644 --- a/rm-server/source/java/org/alfresco/repo/security/permissions/impl/RMPermissionServiceImpl.java +++ b/rm-server/source/java/org/alfresco/repo/security/permissions/impl/RMPermissionServiceImpl.java @@ -35,6 +35,7 @@ import org.alfresco.repo.cache.SimpleCache; import org.alfresco.repo.security.permissions.AccessControlEntry; import org.alfresco.repo.security.permissions.AccessControlList; import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.cmr.security.AccessPermission; import org.alfresco.service.cmr.security.AccessStatus; import org.alfresco.service.cmr.security.AuthorityType; import org.alfresco.service.cmr.security.PermissionService; @@ -117,15 +118,15 @@ public class RMPermissionServiceImpl extends PermissionServiceImpl public AccessStatus hasPermission(NodeRef nodeRef, String perm) { AccessStatus acs = super.hasPermission(nodeRef, perm); - if (AccessStatus.DENIED.equals(acs) && - PermissionService.READ.equals(perm) && - nodeService.hasAspect(nodeRef, RecordsManagementModel.ASPECT_FILE_PLAN_COMPONENT)) + if (AccessStatus.DENIED.equals(acs) == true && + PermissionService.READ.equals(perm) == true && + nodeService.hasAspect(nodeRef, RecordsManagementModel.ASPECT_FILE_PLAN_COMPONENT) == true) { return super.hasPermission(nodeRef, RMPermissionModel.READ_RECORDS); } - else if (AccessStatus.DENIED.equals(acs) && - PermissionService.WRITE.equals(perm) && - nodeService.hasAspect(nodeRef, RecordsManagementModel.ASPECT_FILE_PLAN_COMPONENT)) + else if (AccessStatus.DENIED.equals(acs) == true && + PermissionService.WRITE.equals(perm) == true && + nodeService.hasAspect(nodeRef, RecordsManagementModel.ASPECT_FILE_PLAN_COMPONENT) == true) { return super.hasPermission(nodeRef, RMPermissionModel.FILE_RECORDS); } @@ -219,7 +220,7 @@ public class RMPermissionServiceImpl extends PermissionServiceImpl * @param aclId * @return */ - public Set getReadersDenied(Long aclId) + private Set getReadersDenied(Long aclId) { AccessControlList acl = aclDaoComponent.getAccessControlList(aclId); @@ -301,11 +302,30 @@ public class RMPermissionServiceImpl extends PermissionServiceImpl public void setInheritParentPermissions(final NodeRef nodeRef, boolean inheritParentPermissions) { final String adminRole = getAdminRole(nodeRef); - if (nodeService.hasAspect(nodeRef, RecordsManagementModel.ASPECT_FILE_PLAN_COMPONENT) && isNotBlank(adminRole) && !inheritParentPermissions) + if (nodeService.hasAspect(nodeRef, RecordsManagementModel.ASPECT_FILE_PLAN_COMPONENT) && isNotBlank(adminRole)) { - setPermission(nodeRef, ExtendedReaderDynamicAuthority.EXTENDED_READER, RMPermissionModel.READ_RECORDS, true); - setPermission(nodeRef, ExtendedWriterDynamicAuthority.EXTENDED_WRITER, RMPermissionModel.FILING, true); - setPermission(nodeRef, adminRole, RMPermissionModel.FILING, true); + if (inheritParentPermissions) + { + Set accessPermissions = getAllSetPermissions(nodeRef); + for (AccessPermission accessPermission : accessPermissions) + { + String authority = accessPermission.getAuthority(); + String permission = accessPermission.getPermission(); + if (accessPermission.isSetDirectly() && + (RMPermissionModel.FILING.equals(permission) || RMPermissionModel.READ_RECORDS.equals(permission)) && + (ExtendedReaderDynamicAuthority.EXTENDED_READER.equals(authority) || ExtendedWriterDynamicAuthority.EXTENDED_WRITER.equals(authority)) || adminRole.equals(authority)) + { + // FIXME!!! + //deletePermission(nodeRef, authority, permission); + } + } + } + else + { + setPermission(nodeRef, ExtendedReaderDynamicAuthority.EXTENDED_READER, RMPermissionModel.READ_RECORDS, true); + setPermission(nodeRef, ExtendedWriterDynamicAuthority.EXTENDED_WRITER, RMPermissionModel.FILING, true); + setPermission(nodeRef, adminRole, RMPermissionModel.FILING, true); + } } super.setInheritParentPermissions(nodeRef, inheritParentPermissions); } diff --git a/rm-server/source/java/org/alfresco/repo/web/scripts/substitutionsuggestions/RmSubstitutionSuggestionsGet.java b/rm-server/source/java/org/alfresco/repo/web/scripts/substitutionsuggestions/RmSubstitutionSuggestionsGet.java index 29249ec9fb..7e5c9b373f 100644 --- a/rm-server/source/java/org/alfresco/repo/web/scripts/substitutionsuggestions/RmSubstitutionSuggestionsGet.java +++ b/rm-server/source/java/org/alfresco/repo/web/scripts/substitutionsuggestions/RmSubstitutionSuggestionsGet.java @@ -35,7 +35,7 @@ import org.alfresco.service.cmr.repository.NodeService; import org.alfresco.service.cmr.repository.StoreRef; import org.alfresco.service.cmr.security.AccessStatus; import org.alfresco.service.namespace.QName; -import org.apache.commons.lang.StringUtils; +import org.apache.cxf.common.util.StringUtils; import org.springframework.extensions.webscripts.Cache; import org.springframework.extensions.webscripts.DeclarativeWebScript; import org.springframework.extensions.webscripts.Status; @@ -163,8 +163,7 @@ public class RmSubstitutionSuggestionsGet extends DeclarativeWebScript * @param fragment * @return */ - private List getSubPathSuggestions(WebScriptRequest req, final String path, final String fragment, boolean unfiled) - { + private List getSubPathSuggestions(WebScriptRequest req, final String path, final String fragment, boolean unfiled) { List pathSuggestions = new ArrayList(); if((path != null) && path.startsWith("/") && (fragment != null)) { @@ -178,8 +177,7 @@ public class RmSubstitutionSuggestionsGet extends DeclarativeWebScript { boolean foundThisPathFragment = false; List children = nodeService.getChildAssocs(currentNode); - for (ChildAssociationRef childAssoc : children) - { + for (ChildAssociationRef childAssoc : children) { NodeRef childNodeRef = childAssoc.getChildRef(); String fileName = (String) nodeService.getProperty(childNodeRef, ContentModel.PROP_NAME); if(fileName.equals(pathFragment) && isNodeRefAppropriateForPathSuggestion(childNodeRef, unfiled)) @@ -201,8 +199,7 @@ public class RmSubstitutionSuggestionsGet extends DeclarativeWebScript { String lowerCaseFragment = fragment.toLowerCase(); List children = nodeService.getChildAssocs(currentNode); - for (ChildAssociationRef childAssoc : children) - { + for (ChildAssociationRef childAssoc : children) { NodeRef childNodeRef = childAssoc.getChildRef(); String fileName = (String) nodeService.getProperty(childNodeRef, ContentModel.PROP_NAME); if((fragment.isEmpty() || fileName.toLowerCase().startsWith(lowerCaseFragment)) && isNodeRefAppropriateForPathSuggestion(childNodeRef, unfiled)) diff --git a/rm-server/source/java/org/alfresco/util/WebScriptUtils.java b/rm-server/source/java/org/alfresco/util/WebScriptUtils.java deleted file mode 100644 index 131687fe7a..0000000000 --- a/rm-server/source/java/org/alfresco/util/WebScriptUtils.java +++ /dev/null @@ -1,322 +0,0 @@ -/* - * Copyright (C) 2005-2014 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - */ -package org.alfresco.util; - -import static org.alfresco.util.ParameterCheck.mandatory; -import static org.alfresco.util.ParameterCheck.mandatoryString; -import static org.apache.commons.lang.StringUtils.isBlank; -import static org.apache.commons.lang3.StringUtils.isBlank; - -import java.io.IOException; -import java.util.List; -import java.util.Map; - -import org.apache.commons.lang3.StringUtils; -import org.json.JSONArray; -import org.json.JSONException; -import org.json.JSONObject; -import org.json.JSONTokener; -import org.springframework.extensions.surf.util.Content; -import org.springframework.extensions.webscripts.Status; -import org.springframework.extensions.webscripts.WebScriptException; -import org.springframework.extensions.webscripts.WebScriptRequest; - -/** - * Utility class for handling webscript requests - * - * @author Tuna Aksoy - * @since 2.3 - */ -public final class WebScriptUtils -{ - private WebScriptUtils() - { - // Will not be called - } - - /** - * Gets the template variable substitutions map - * - * @param req The webscript request - * @return The template variable substitutions - */ - public static Map getTemplateVars(WebScriptRequest req) - { - mandatory("req", req); - - if (req.getServiceMatch() == null) - { - throw new WebScriptException(Status.STATUS_BAD_REQUEST, "The matching API Service for the request is null."); - } - - Map templateVars = req.getServiceMatch().getTemplateVars(); - if (templateVars == null) - { - throw new WebScriptException(Status.STATUS_BAD_REQUEST, "The template variable substitutions map is null"); - } - - return templateVars; - } - - /** - * Gets the value of a request parameter - * - * @param req The webscript request - * @param parameter The request parameter - * @return The value of the request parameter - */ - public static String getRequestParameterValue(WebScriptRequest req, String parameter) - { - mandatory("req", req); - mandatoryString("parameter", parameter); - - return getRequestParameterValue(req, parameter, true); - } - - /** - * Gets the value of a request parameter - * - * @param req The webscript request - * @param parameter The request parameter - * @param checkValue Determines if the value of the parameter should be checked or not - * @return The value of the request parameter - */ - public static String getRequestParameterValue(WebScriptRequest req, String parameter, boolean checkValue) - { - mandatory("req", req); - mandatoryString("parameter", parameter); - - Map templateVars = getTemplateVars(req); - String value = templateVars.get(parameter); - - if (checkValue && isBlank(value)) - { - throw new WebScriptException(Status.STATUS_NOT_FOUND, "The value for the parameter '" + parameter + "' is blank."); - } - - return value; - } - - /** - * Gets the request content as JSON object - * - * @param req The webscript request - * @return The request content as JSON object - */ - public static JSONObject getRequestContentAsJsonObject(WebScriptRequest req) - { - mandatory("req", req); - - Content reqContent = req.getContent(); - if (reqContent == null) - { - throw new WebScriptException(Status.STATUS_BAD_REQUEST, "Missing request body."); - } - - String content; - try - { - content = reqContent.getContent(); - } - catch (IOException error) - { - throw new WebScriptException(Status.STATUS_BAD_REQUEST, "Could not get content from the request.", error); - } - - if (StringUtils.isBlank(content)) - { - throw new WebScriptException(Status.STATUS_BAD_REQUEST, "Content does not exist."); - } - - JSONTokener jsonTokener = new JSONTokener(content); - - JSONObject json; - try - { - json = new JSONObject(jsonTokener); - } - catch (JSONException error) - { - throw new WebScriptException(Status.STATUS_BAD_REQUEST, "Unable to parse request body.", error); - } - - return json; - } - - /** - * Checks if the json object contains an entry with the specified parameter name - * - * @param jsonObject The json object - * @param paramName The parameter name to check for - */ - public static void checkMandatoryJsonParam(JSONObject jsonObject, String paramName) - { - mandatory("jsonObject", jsonObject); - mandatoryString("paramName", paramName); - - if (!jsonObject.has(paramName)) - { - throw new WebScriptException(Status.STATUS_BAD_REQUEST, "The json object does not contain en entry with parameter '" + paramName + "'."); - } - } - - /** - * Checks if the json object contains entries with the specified parameter names - * - * @param jsonObject The json object. - * @param paramNames The parameter names to check for - */ - public static void checkMandatoryJsonParams(JSONObject jsonObject, List paramNames) - { - mandatory("jsonObject", jsonObject); - mandatory("paramNames", paramNames); - - for (String name : paramNames) - { - checkMandatoryJsonParam(jsonObject, name); - } - } - - /** - * Gets the {@link String} value of a given key from a json object - * - * @param jsonObject The json object - * @param key The key - * @return The {@link String} value of the given key from the json object - */ - public static String getStringValueFromJSONObject(JSONObject jsonObject, String key) - { - mandatory("jsonObject", jsonObject); - mandatoryString("key", key); - - return getStringValueFromJSONObject(jsonObject, key, true, true); - } - - /** - * Gets the {@link String} value of a given key from a json object - * - * @param jsonObject The json object - * @param key The key - * @param checkKey Determines if the existence of the key should be checked - * @param checkValue Determines if the value should be checked if it is blank or not - * @return The {@link String} value of the given key from the json object - */ - public static String getStringValueFromJSONObject(JSONObject jsonObject, String key, boolean checkKey, boolean checkValue) - { - mandatory("jsonObject", jsonObject); - mandatoryString("key", key); - - if (checkKey) - { - checkMandatoryJsonParam(jsonObject, key); - } - - String value = null; - - try - { - value = jsonObject.getString(key); - if (checkValue && isBlank(value)) - { - throw new WebScriptException(Status.STATUS_BAD_REQUEST, "The vale is missing for the key '" + key + "'."); - } - } - catch (JSONException error) - { - if (checkValue) - { - throw new WebScriptException(Status.STATUS_BAD_REQUEST, "Could not get value for the key '" + key + "'.", error); - } - } - - return value; - } - - /** - * Puts the given key and value to the json object - * - * @param jsonObject The json object - * @param key The key - * @param value The value - */ - public static void putValuetoJSONObject(JSONObject jsonObject, String key, Object value) - { - mandatory("jsonObject", jsonObject); - mandatoryString("key", key); - mandatory("value", value); - - try - { - jsonObject.put(key, value); - } - catch (JSONException error) - { - throw new WebScriptException(Status.STATUS_BAD_REQUEST, "Could not put the key '" + key + "' with the value '" + value + "' to the json object.", error); - } - } - - /** - * Gets the value of an element from a json array at the given index - * - * @param jsonArray The json array - * @param index The index - * @return The value of the element - */ - public static Object getJSONArrayValue(JSONArray jsonArray, int index) - { - mandatory("jsonArray", jsonArray); - - Object value; - - try - { - value = jsonArray.get(index); - } - catch (JSONException error) - { - throw new WebScriptException(Status.STATUS_BAD_REQUEST, "Could not get value for the index '" + index + "' from the JSON Array.", error); - } - - return value; - } - - /** - * Creates a json object from the given {@link String} - * - * @param json The json object as {@link String} - * @return The json object created from the given {@link String} - */ - public static JSONObject createJSONObject(String json) - { - mandatory("json", json); - - JSONObject jsonObject; - - try - { - jsonObject = new JSONObject(json); - } - catch (JSONException error) - { - throw new WebScriptException(Status.STATUS_BAD_REQUEST, "Cannot create a json object from the given string '" + json + "'.", error); - } - - return jsonObject; - } -} diff --git a/rm-server/source/java/org/alfresco/workflow/requestInfo/RequestInfoUtils.java b/rm-server/source/java/org/alfresco/workflow/requestInfo/RequestInfoUtils.java index ce435543da..d7aa24145a 100644 --- a/rm-server/source/java/org/alfresco/workflow/requestInfo/RequestInfoUtils.java +++ b/rm-server/source/java/org/alfresco/workflow/requestInfo/RequestInfoUtils.java @@ -23,7 +23,6 @@ import java.util.List; import org.activiti.engine.delegate.DelegateTask; import org.activiti.engine.impl.cfg.ProcessEngineConfigurationImpl; import org.activiti.engine.impl.context.Context; -import org.alfresco.error.AlfrescoRuntimeException; import org.alfresco.model.ContentModel; import org.alfresco.repo.security.authentication.AuthenticationUtil; import org.alfresco.repo.workflow.activiti.ActivitiConstants; @@ -62,7 +61,7 @@ public final class RequestInfoUtils ServiceRegistry registry = (ServiceRegistry) config.getBeans().get(ActivitiConstants.SERVICE_REGISTRY_BEAN_KEY); if (registry == null) { - throw new AlfrescoRuntimeException( + throw new RuntimeException( "Service-registry not present in ProcessEngineConfiguration beans, expected ServiceRegistry with key" + ActivitiConstants.SERVICE_REGISTRY_BEAN_KEY); } diff --git a/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/IntegrationTestSuite.java b/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/IntegrationTestSuite.java index ada86601c6..23b3469a87 100755 --- a/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/IntegrationTestSuite.java +++ b/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/IntegrationTestSuite.java @@ -26,10 +26,7 @@ import org.alfresco.module.org_alfresco_module_rm.test.integration.issue.IssueTe import org.alfresco.module.org_alfresco_module_rm.test.integration.job.JobTestSuite; import org.alfresco.module.org_alfresco_module_rm.test.integration.record.RecordTestSuite; import org.alfresco.module.org_alfresco_module_rm.test.integration.recordfolder.RecordFolderTestSuite; -import org.alfresco.module.org_alfresco_module_rm.test.integration.relationship.RelationshipTestSuite; import org.alfresco.module.org_alfresco_module_rm.test.integration.report.ReportTestSuite; -import org.alfresco.module.org_alfresco_module_rm.test.integration.transfer.TransferTestSuite; -import org.alfresco.module.org_alfresco_module_rm.test.integration.version.VersionTestSuite; import org.junit.runner.RunWith; import org.junit.runners.Suite; import org.junit.runners.Suite.SuiteClasses; @@ -52,10 +49,7 @@ import org.junit.runners.Suite.SuiteClasses; RecordTestSuite.class, RecordFolderTestSuite.class, JobTestSuite.class, - HoldTestSuite.class, - VersionTestSuite.class, - RelationshipTestSuite.class, - TransferTestSuite.class + HoldTestSuite.class }) public class IntegrationTestSuite { diff --git a/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/dod/RM1194ExcludeDoDRecordTypesTest.java b/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/dod/RM1194ExcludeDoDRecordTypesTest.java index 5019fc9114..f44d4bb753 100755 --- a/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/dod/RM1194ExcludeDoDRecordTypesTest.java +++ b/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/dod/RM1194ExcludeDoDRecordTypesTest.java @@ -108,7 +108,7 @@ public class RM1194ExcludeDoDRecordTypesTest extends BaseRMTestCase implements D assertNotNull(record); Set aspects = recordService.getRecordMetadataAspects(record); assertNotNull(aspects); - assertEquals(1, aspects.size()); + assertEquals(2, aspects.size()); } }); } diff --git a/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/hold/CreateHoldTest.java b/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/hold/CreateHoldTest.java deleted file mode 100644 index 08f6af286f..0000000000 --- a/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/hold/CreateHoldTest.java +++ /dev/null @@ -1,128 +0,0 @@ -/* - * Copyright (C) 2005-2015 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - */ -package org.alfresco.module.org_alfresco_module_rm.test.integration.hold; - -import static org.alfresco.repo.security.authentication.AuthenticationUtil.getAdminUserName; -import static org.alfresco.repo.security.authentication.AuthenticationUtil.runAs; -import static org.alfresco.repo.site.SiteModel.SITE_CONSUMER; -import static org.alfresco.service.cmr.security.AccessStatus.ALLOWED; -import static org.alfresco.util.GUID.generate; - -import java.util.HashSet; -import java.util.Set; - -import org.alfresco.module.org_alfresco_module_rm.capability.Capability; -import org.alfresco.module.org_alfresco_module_rm.role.Role; -import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase; -import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork; -import org.alfresco.service.cmr.repository.NodeRef; - -/** - * Tests that the user who created the hold has filing permissions on the created hold. - * - * @author Tuna Aksoy - * @since 2.3 - */ -public class CreateHoldTest extends BaseRMTestCase -{ - // Test user - private String testUser = null; - - /** - * @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase#isUserTest() - */ - @Override - protected boolean isUserTest() - { - return true; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase#setupTestUsersImpl(org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - protected void setupTestUsersImpl(NodeRef filePlan) - { - super.setupTestUsersImpl(filePlan); - - // Create test user - testUser = generate(); - createPerson(testUser); - - // Join the RM site - siteService.setMembership(siteId, testUser, SITE_CONSUMER); - - // Create role - Set capabilities = new HashSet(2); - capabilities.add(capabilityService.getCapability(VIEW_RECORDS)); - capabilities.add(capabilityService.getCapability(CREATE_HOLD)); - Role role = filePlanRoleService.createRole(filePlan, generate(), generate(), capabilities); - - // Add the test user to RM Records Manager role - filePlanRoleService.assignRoleToAuthority(filePlan, role.getName(), testUser); - } - - public void testFilingPermissionOnCreatedHold() - { - doBehaviourDrivenTest(new BehaviourDrivenTest(testUser) - { - // Hold - private NodeRef hold; - - /** - * @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase.BehaviourDrivenTest#given() - */ - @Override - public void given() throws Exception - { - // Give test user filing permissions on hold container - runAs(new RunAsWork() - { - public Void doWork() throws Exception - { - // ensure the user has the correct permission to create the hold - filePlanPermissionService.setPermission(holdsContainer, testUser, FILING); - - return null; - } - }, getAdminUserName()); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase.BehaviourDrivenTest#when() - */ - @Override - public void when() throws Exception - { - // Create a hold - hold = holdService.createHold(filePlan, generate(), generate(), generate()); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase.BehaviourDrivenTest#then() - */ - @Override - public void then() throws Exception - { - // Check the permission on the hold - assertEquals(ALLOWED, permissionService.hasPermission(hold, FILING)); - } - }); - } -} diff --git a/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/hold/HoldTestSuite.java b/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/hold/HoldTestSuite.java index fc81361be2..fb488c95eb 100644 --- a/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/hold/HoldTestSuite.java +++ b/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/hold/HoldTestSuite.java @@ -32,8 +32,7 @@ import org.junit.runners.Suite.SuiteClasses; @SuiteClasses( { DeleteHoldTest.class, - AddRemoveFromHoldTest.class, - CreateHoldTest.class + AddRemoveFromHoldTest.class }) public class HoldTestSuite { diff --git a/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/issue/IssueTestSuite.java b/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/issue/IssueTestSuite.java index 30ee5f9ce2..2c11e9689e 100755 --- a/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/issue/IssueTestSuite.java +++ b/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/issue/IssueTestSuite.java @@ -42,12 +42,7 @@ import org.junit.runners.Suite.SuiteClasses; RM804Test.class, RM994Test.class, RM1039Test.class, - RM1727Test.class, - RM1799Test.class, - RM1814Test.class, - RM978Test.class, - RM1887Test.class, - RM1914Test.class + RM1799Test.class }) public class IssueTestSuite { diff --git a/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/issue/RM1030Test.java b/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/issue/RM1030Test.java index 3f692b4adb..e3e63b8727 100755 --- a/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/issue/RM1030Test.java +++ b/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/issue/RM1030Test.java @@ -19,9 +19,7 @@ package org.alfresco.module.org_alfresco_module_rm.test.integration.issue; import java.util.List; -import java.util.Set; -import org.alfresco.module.org_alfresco_module_rm.role.FilePlanRoleService; import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase; import org.alfresco.service.cmr.repository.NodeRef; @@ -47,12 +45,6 @@ public class RM1030Test extends BaseRMTestCase @Override public NodeRef run() { - Set auths = filePlanRoleService.getAllAssignedToRole(filePlan, FilePlanRoleService.ROLE_ADMIN); - for (String auth : auths) - { - System.out.println(auth); - } - // show there are no holds when we start List holds = holdService.getHolds(filePlan); assertNotNull(holds); diff --git a/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/issue/RM1727Test.java b/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/issue/RM1727Test.java deleted file mode 100644 index d07c26301d..0000000000 --- a/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/issue/RM1727Test.java +++ /dev/null @@ -1,102 +0,0 @@ -/* - * Copyright (C) 2005-2014 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - */ -package org.alfresco.module.org_alfresco_module_rm.test.integration.issue; - -import org.alfresco.module.org_alfresco_module_rm.capability.RMPermissionModel; -import org.alfresco.module.org_alfresco_module_rm.forms.RecordsManagementNodeFormFilter; -import org.alfresco.module.org_alfresco_module_rm.role.FilePlanRoleService; -import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase; -import org.alfresco.repo.forms.Form; -import org.alfresco.repo.forms.Item; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.util.GUID; - -/** - * Test for RM-1727 - * - * @author Tatsiana Shalima - * @since 2.3 - */ -public class RM1727Test extends BaseRMTestCase -{ - private String myUser; - private NodeRef folder; - private NodeRef record; - - private RecordsManagementNodeFormFilter nodeFormFilter; - private Form form; - - @Override - protected boolean isRecordTest() - { - return true; - } - - @Override - protected boolean isUserTest() - { - return true; - } - - @Override - protected void setupTestUsersImpl(NodeRef filePlan) - { - nodeFormFilter = (RecordsManagementNodeFormFilter)applicationContext.getBean("rmNodeFormFilter"); - //create user - myUser = GUID.generate(); - createPerson(myUser); - //give user RM Manager role - filePlanRoleService.assignRoleToAuthority(filePlan, FilePlanRoleService.ROLE_RECORDS_MANAGER, myUser); - //create category > folder > record - NodeRef category = filePlanService.createRecordCategory(filePlan, GUID.generate()); - folder = recordFolderService.createRecordFolder(category, GUID.generate()); - record = recordService.createRecordFromContent(folder, GUID.generate(), TYPE_CONTENT, null, null); - } - - public void testRM1727() - { - //set read and file permissions for folder - filePlanPermissionService.setPermission(folder, myUser, RMPermissionModel.FILING); - doTestInTransaction(new Test() - { - @Override - public Void run() - { - Item item = new Item("node",folder.toString()); - item.setType("rma:recordFolder"); - form = new Form(item); - nodeFormFilter.afterGenerate(folder, null, null, form, null); - return null; - } - }, myUser); - - doTestInTransaction(new Test() - { - @Override - public Void run() - { - Item item = new Item("node",record.toString()); - item.setType("rma:record"); - form = new Form(item); - nodeFormFilter.afterGenerate(record, null, null, form, null); - return null; - } - }, myUser); - } -} diff --git a/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/issue/RM1814Test.java b/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/issue/RM1814Test.java deleted file mode 100644 index e680de2c67..0000000000 --- a/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/issue/RM1814Test.java +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Copyright (C) 2005-2015 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - */ -package org.alfresco.module.org_alfresco_module_rm.test.integration.issue; - -import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.util.GUID; - -/** - * Test for RM-1814 - * - * @author Tuna Aksoy - * @since 2.3 - */ -public class RM1814Test extends BaseRMTestCase -{ - @Override - protected boolean isRecordTest() - { - return true; - } - - public void testRM1814() throws Exception - { - doTestInTransaction(new Test() - { - @Override - public Void run() - { - NodeRef hold = holdService.createHold(filePlan, GUID.generate(), GUID.generate(), GUID.generate()); - holdService.addToHold(hold, recordTwo); - return null; - } - }); - - doTestInTransaction(new Test() - { - @Override - public Void run() - { - relationshipService.addRelationship(CUSTOM_REF_VERSIONS.getLocalName(), recordOne, recordThree); - return null; - } - }); - - doTestInTransaction(new FailureTest - ( - "Target node is in a hold." - ) - { - @Override - public void run() throws Exception - { - relationshipService.addRelationship(CUSTOM_REF_OBSOLETES.getLocalName(), recordOne, recordTwo); - } - }); - - doTestInTransaction(new Test() - { - @Override - public Void run() - { - relationshipService.addRelationship(CUSTOM_REF_SUPPORTS.getLocalName(), recordOne, recordFour); - return null; - } - }); - } -} diff --git a/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/issue/RM1887Test.java b/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/issue/RM1887Test.java deleted file mode 100644 index 556e736631..0000000000 --- a/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/issue/RM1887Test.java +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Copyright (C) 2005-2014 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - */ -package org.alfresco.module.org_alfresco_module_rm.test.integration.issue; - -import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase; -import org.alfresco.service.cmr.repository.NodeRef; - - -/** - * Integration test for RM-1887 - * - * @author Roy Wetherall - * @since 2.3 - */ -public class RM1887Test extends BaseRMTestCase -{ - @Override - protected boolean isRecordTest() - { - return true; - } - - /** - * Given that a record is unfiled - * And an unfiled folder has been created - * When I move the unfiled record into the unfiled folder - * Then the filed date of the unfiled record remains unset - */ - public void testMoveUnfiledRecord() throws Exception - { - doBehaviourDrivenTest(new BehaviourDrivenTest() - { - private NodeRef unfiledRecordFolder; - private NodeRef unfiledRecord; - - public void given() throws Exception - { - // create unfiled folder - unfiledRecordFolder = fileFolderService.create(filePlanService.getUnfiledContainer(filePlan), "my test folder", TYPE_UNFILED_RECORD_FOLDER).getNodeRef(); - - // crate unfiled record - unfiledRecord = recordService.createRecordFromContent(filePlan, "test.txt", TYPE_CONTENT, null, null); - - // check the record - assertTrue(recordService.isRecord(unfiledRecord)); - assertFalse(recordService.isFiled(unfiledRecord)); - } - - public void when() throws Exception - { - // move the record into the unfiled folder - fileFolderService.move(unfiledRecord, unfiledRecordFolder, null); - } - - public void then() - { - // check the record - assertTrue(recordService.isRecord(unfiledRecord)); - assertFalse(recordService.isFiled(unfiledRecord)); - } - }); - - } - - -} diff --git a/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/issue/RM1914Test.java b/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/issue/RM1914Test.java deleted file mode 100644 index 4f75c5bb68..0000000000 --- a/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/issue/RM1914Test.java +++ /dev/null @@ -1,139 +0,0 @@ -/* - * Copyright (C) 2005-2014 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - */ -package org.alfresco.module.org_alfresco_module_rm.test.integration.issue; - -import java.io.Serializable; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -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.TransferAction; -import org.alfresco.module.org_alfresco_module_rm.action.impl.TransferCompleteAction; -import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionSchedule; -import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase; -import org.alfresco.module.org_alfresco_module_rm.test.util.CommonRMTestUtils; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.namespace.QName; -import org.alfresco.util.GUID; -import org.apache.commons.lang.StringUtils; - -/** - * - * @author Ana Bozianu - * @since 2.3 - */ -public class RM1914Test extends BaseRMTestCase -{ - - public void testRM1914() throws Exception - { - doBehaviourDrivenTest(new BehaviourDrivenTest() - { - - NodeRef record1; - NodeRef record2; - - public void given() - { - // 1. Any Category1, Category2 are created - NodeRef category1 = filePlanService.createRecordCategory(filePlan, GUID.generate()); - NodeRef category2 = filePlanService.createRecordCategory(filePlan, GUID.generate()); - - - // 2. Disposition schedule is created for the Category1: - // - applied on Record - Map dsProps = new HashMap(3); - dsProps.put(PROP_DISPOSITION_AUTHORITY, CommonRMTestUtils.DEFAULT_DISPOSITION_AUTHORITY); - dsProps.put(PROP_DISPOSITION_INSTRUCTIONS, GUID.generate()); - dsProps.put(PROP_RECORD_LEVEL_DISPOSITION, true); - - DispositionSchedule dispositionSchedule1 = dispositionService.createDispositionSchedule(category1, dsProps); - - // - add cutoff after "Related Record Transferred To Inactive Storage" completion event - Map dispositionAction1 = new HashMap(3); - dispositionAction1.put(PROP_DISPOSITION_ACTION_NAME, CutOffAction.NAME); - dispositionAction1.put(PROP_DISPOSITION_DESCRIPTION, GUID.generate()); - - List events = new ArrayList(1); - events.add("related_record_trasfered_inactive_storage"); - dispositionAction1.put(PROP_DISPOSITION_EVENT, (Serializable)events); - - dispositionService.addDispositionActionDefinition(dispositionSchedule1, dispositionAction1); - - - // 3. Folder1 > Record1 is created inside Category1 - NodeRef folder1 = recordFolderService.createRecordFolder(category1, GUID.generate()); - record1 = recordService.createRecordFromContent(folder1, GUID.generate(), TYPE_CONTENT, null, null); - - - // 4. Disposition schedule is created for the Category2: - // applied on Record - DispositionSchedule dispositionSchedule2 = dispositionService.createDispositionSchedule(category2, dsProps); - - // - cutoff immediatelly - Map dispositionAction2_1 = new HashMap(3); - dispositionAction2_1.put(PROP_DISPOSITION_ACTION_NAME, CutOffAction.NAME); - dispositionAction2_1.put(PROP_DISPOSITION_DESCRIPTION, GUID.generate()); - dispositionAction2_1.put(PROP_DISPOSITION_PERIOD, CommonRMTestUtils.PERIOD_IMMEDIATELY); - - dispositionService.addDispositionActionDefinition(dispositionSchedule2, dispositionAction2_1); - - // - Transfer Immediatelly - Map dispositionAction2_2 = new HashMap(4); - dispositionAction2_2.put(PROP_DISPOSITION_ACTION_NAME, TransferAction.NAME); - dispositionAction2_2.put(PROP_DISPOSITION_DESCRIPTION, GUID.generate()); - dispositionAction2_2.put(PROP_DISPOSITION_PERIOD, CommonRMTestUtils.PERIOD_IMMEDIATELY); - dispositionAction2_2.put(PROP_DISPOSITION_LOCATION, StringUtils.EMPTY); - - dispositionService.addDispositionActionDefinition(dispositionSchedule2, dispositionAction2_2); - - // 5. Folder2 > Record2 is created inside Category2 - NodeRef folder2 = recordFolderService.createRecordFolder(category2, GUID.generate()); - record2 = recordService.createRecordFromContent(folder2, GUID.generate(), TYPE_CONTENT, null, null); - - // 6. Record1 and Record2 are completed - utils.completeRecord(record1); - utils.completeRecord(record2); - - // 7. Create Cross-Reference link from Record1 to Record2 - relationshipService.addRelationship(CUSTOM_REF_CROSSREFERENCE.getLocalName(), record1, record2); - - - } - - public void when() - { - // 8. Cut off and transfer Record2 - rmActionService.executeRecordsManagementAction(record2, CutOffAction.NAME, null); - NodeRef transferFolder = (NodeRef) rmActionService.executeRecordsManagementAction(record2, TransferAction.NAME).getValue(); - rmActionService.executeRecordsManagementAction(transferFolder, TransferCompleteAction.NAME); - - } - - public void then() - { - // 9. Verify Record1 - assertTrue(dispositionService.isNextDispositionActionEligible(record1)); - - } - }); - } -} diff --git a/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/issue/RM978Test.java b/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/issue/RM978Test.java deleted file mode 100644 index d4270d2d7f..0000000000 --- a/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/issue/RM978Test.java +++ /dev/null @@ -1,868 +0,0 @@ -/* - * Copyright (C) 2005-2015 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - */ -package org.alfresco.module.org_alfresco_module_rm.test.integration.issue; - -import static org.alfresco.repo.security.authentication.AuthenticationUtil.getAdminUserName; -import static org.alfresco.repo.security.authentication.AuthenticationUtil.runAs; - -import java.util.ArrayList; -import java.util.List; - -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.role.FilePlanRoleService; -import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase; -import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork; -import org.alfresco.repo.site.SiteModel; -import org.alfresco.repo.site.SiteServiceImpl; -import org.alfresco.service.cmr.model.FileExistsException; -import org.alfresco.service.cmr.model.FileNotFoundException; -import org.alfresco.service.cmr.repository.ChildAssociationRef; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.site.SiteService; -import org.alfresco.service.cmr.site.SiteVisibility; -import org.alfresco.util.GUID; - -/** - * Test for RM-978 - * - * @author Tuna Aksoy - * @since 2.3 - */ -public class RM978Test extends BaseRMTestCase -{ - private NodeRef documentLibrary2; - private String user; - - /** - * @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase#isCollaborationSiteTest() - */ - @Override - protected boolean isCollaborationSiteTest() - { - return true; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase#setupCollaborationSiteTestDataImpl() - */ - @Override - protected void setupCollaborationSiteTestDataImpl() - { - super.setupCollaborationSiteTestDataImpl(); - - String collabSiteId2 = GUID.generate(); - siteService.createSite("site-dashboard", collabSiteId2, GUID.generate(), GUID.generate(), SiteVisibility.PUBLIC); - documentLibrary2 = SiteServiceImpl.getSiteContainer( - collabSiteId2, - SiteService.DOCUMENT_LIBRARY, - true, - siteService, - transactionService, - taggingService); - - assertNotNull("Collaboration site document library component was not successfully created.", documentLibrary2); - - user = GUID.generate(); - createPerson(user); - siteService.setMembership(collabSiteId, user, SiteModel.SITE_CONTRIBUTOR); - siteService.setMembership(collabSiteId2, user, SiteModel.SITE_CONTRIBUTOR); - siteService.setMembership(siteId, user, SiteModel.SITE_CONSUMER); - filePlanRoleService.assignRoleToAuthority(filePlan, FilePlanRoleService.ROLE_POWER_USER, user); - } - - public void testMoveDocumentToFolderInCollabSite() - { - doBehaviourDrivenTest(new BehaviourDrivenTest(user) - { - private NodeRef folder1; - private NodeRef folder2; - private NodeRef document1; - private String document1Name = GUID.generate(); - - public void given() - { - folder1 = fileFolderService.create(documentLibrary, GUID.generate(), ContentModel.TYPE_FOLDER).getNodeRef(); - document1 = fileFolderService.create(folder1, document1Name, ContentModel.TYPE_CONTENT).getNodeRef(); - folder2 = fileFolderService.create(documentLibrary, GUID.generate(), ContentModel.TYPE_FOLDER).getNodeRef(); - } - - public void when() throws FileExistsException, FileNotFoundException - { - fileFolderService.move(document1, folder2, null); - } - - public void then() - { - List folder1ChildAssocs = nodeService.getChildAssocs(folder1); - assertEquals(0, folder1ChildAssocs.size()); - - List folder2ChildAssocs = nodeService.getChildAssocs(folder2); - assertNotNull(folder2ChildAssocs); - assertEquals(1, folder2ChildAssocs.size()); - NodeRef movedDocument = folder2ChildAssocs.iterator().next().getChildRef(); - String movedDocumentName = (String) nodeService.getProperty(movedDocument, ContentModel.PROP_NAME); - assertEquals(document1Name, movedDocumentName); - } - }); - } - - public void testMoveDocumentToDocumentLibraryInCollabSite() - { - doBehaviourDrivenTest(new BehaviourDrivenTest(user) - { - private NodeRef folder1; - private NodeRef document1; - private String document1Name = GUID.generate(); - - public void given() - { - folder1 = fileFolderService.create(documentLibrary, GUID.generate(), ContentModel.TYPE_FOLDER).getNodeRef(); - document1 = fileFolderService.create(folder1, document1Name, ContentModel.TYPE_CONTENT).getNodeRef(); - } - - public void when() throws FileExistsException, FileNotFoundException - { - fileFolderService.move(document1, documentLibrary, null); - } - - public void then() - { - List folder1ChildAssocs = nodeService.getChildAssocs(folder1); - assertEquals(0, folder1ChildAssocs.size()); - - List childAssocs = nodeService.getChildAssocs(documentLibrary); - assertNotNull(childAssocs); - - List childNames = new ArrayList(); - for (ChildAssociationRef childAssociationRef : childAssocs) - { - NodeRef childRef = childAssociationRef.getChildRef(); - childNames.add((String) nodeService.getProperty(childRef, ContentModel.PROP_NAME)); - } - - assertTrue(childNames.contains(document1Name)); - } - }); - } - - public void testMoveFolderToFolderInCollabSite() - { - doBehaviourDrivenTest(new BehaviourDrivenTest(user) - { - private NodeRef folder1; - private NodeRef folder2; - private String folder1Name = GUID.generate(); - - public void given() - { - folder1 = fileFolderService.create(documentLibrary, folder1Name, ContentModel.TYPE_FOLDER).getNodeRef(); - folder2 = fileFolderService.create(documentLibrary, GUID.generate(), ContentModel.TYPE_FOLDER).getNodeRef(); - } - - public void when() throws FileExistsException, FileNotFoundException - { - fileFolderService.move(folder1, folder2, null); - } - - public void then() - { - List folder2ChildAssocs = nodeService.getChildAssocs(folder2); - assertEquals(1, folder2ChildAssocs.size()); - NodeRef movedFolder = folder2ChildAssocs.iterator().next().getChildRef(); - String movedDocumentName = (String) nodeService.getProperty(movedFolder, ContentModel.PROP_NAME); - assertEquals(folder1Name, movedDocumentName); - } - }); - } - - public void testMoveDocumentToFolderInDifferentCollabSite() - { - doBehaviourDrivenTest(new BehaviourDrivenTest(user) - { - private NodeRef folder1; - private NodeRef folder2; - private NodeRef document1; - private String document1Name = GUID.generate(); - - public void given() - { - folder1 = fileFolderService.create(documentLibrary, GUID.generate(), ContentModel.TYPE_FOLDER).getNodeRef(); - document1 = fileFolderService.create(folder1, document1Name, ContentModel.TYPE_CONTENT).getNodeRef(); - folder2 = fileFolderService.create(documentLibrary2, GUID.generate(), ContentModel.TYPE_FOLDER).getNodeRef(); - } - - public void when() throws FileExistsException, FileNotFoundException - { - fileFolderService.move(document1, folder2, null); - } - - public void then() - { - List folder1ChildAssocs = nodeService.getChildAssocs(folder1); - assertEquals(0, folder1ChildAssocs.size()); - - List folder2ChildAssocs = nodeService.getChildAssocs(folder2); - assertNotNull(folder2ChildAssocs); - assertEquals(1, folder2ChildAssocs.size()); - NodeRef movedDocument = folder2ChildAssocs.iterator().next().getChildRef(); - String movedDocumentName = (String) nodeService.getProperty(movedDocument, ContentModel.PROP_NAME); - assertEquals(document1Name, movedDocumentName); - } - }); - } - - public void testMoveDocumentToDocumentLibraryInDifferentCollabSite() - { - doBehaviourDrivenTest(new BehaviourDrivenTest(user) - { - private NodeRef folder1; - private NodeRef document1; - private String document1Name = GUID.generate(); - - public void given() - { - folder1 = fileFolderService.create(documentLibrary, GUID.generate(), ContentModel.TYPE_FOLDER).getNodeRef(); - document1 = fileFolderService.create(folder1, document1Name, ContentModel.TYPE_CONTENT).getNodeRef(); - } - - public void when() throws FileExistsException, FileNotFoundException - { - fileFolderService.move(document1, documentLibrary2, null); - } - - public void then() - { - List folder1ChildAssocs = nodeService.getChildAssocs(folder1); - assertEquals(0, folder1ChildAssocs.size()); - - List childAssocs = nodeService.getChildAssocs(documentLibrary2); - assertNotNull(childAssocs); - - List childNames = new ArrayList(); - for (ChildAssociationRef childAssociationRef : childAssocs) - { - NodeRef childRef = childAssociationRef.getChildRef(); - childNames.add((String) nodeService.getProperty(childRef, ContentModel.PROP_NAME)); - } - - assertTrue(childNames.contains(document1Name)); - } - }); - } - - public void testMoveFolderToFolderInDifferentCollabSite() - { - doBehaviourDrivenTest(new BehaviourDrivenTest(user) - { - private NodeRef folder1; - private NodeRef folder2; - private String folder1Name = GUID.generate(); - - public void given() - { - folder1 = fileFolderService.create(documentLibrary, folder1Name, ContentModel.TYPE_FOLDER).getNodeRef(); - folder2 = fileFolderService.create(documentLibrary2, GUID.generate(), ContentModel.TYPE_FOLDER).getNodeRef(); - } - - public void when() throws FileExistsException, FileNotFoundException - { - fileFolderService.move(folder1, folder2, null); - } - - public void then() - { - List folder2ChildAssocs = nodeService.getChildAssocs(folder2); - assertEquals(1, folder2ChildAssocs.size()); - NodeRef movedFolder = folder2ChildAssocs.iterator().next().getChildRef(); - String movedDocumentName = (String) nodeService.getProperty(movedFolder, ContentModel.PROP_NAME); - assertEquals(folder1Name, movedDocumentName); - } - }); - } - - public void testMoveDocumentInFilePlanInRmSite() - { - doBehaviourDrivenTest(new BehaviourDrivenTest(AlfrescoRuntimeException.class, user) - { - private NodeRef folder1; - private NodeRef document1; - - public void given() - { - folder1 = fileFolderService.create(documentLibrary, GUID.generate(), ContentModel.TYPE_FOLDER).getNodeRef(); - document1 = fileFolderService.create(folder1, GUID.generate(), ContentModel.TYPE_CONTENT).getNodeRef(); - } - - public void when() throws FileExistsException, FileNotFoundException - { - fileFolderService.move(document1, filePlan, GUID.generate()); - } - }); - } - - public void testMoveDocumentInCategoryInRmSite() - { - doBehaviourDrivenTest(new BehaviourDrivenTest(AlfrescoRuntimeException.class, user) - { - private NodeRef folder1; - private NodeRef document1; - private NodeRef rmCategory; - - public void given() - { - folder1 = fileFolderService.create(documentLibrary, GUID.generate(), ContentModel.TYPE_FOLDER).getNodeRef(); - document1 = fileFolderService.create(folder1, GUID.generate(), ContentModel.TYPE_CONTENT).getNodeRef(); - - runAs(new RunAsWork() - { - public Void doWork() throws Exception - { - rmCategory = filePlanService.createRecordCategory(filePlan, GUID.generate()); - - return null; - } - }, getAdminUserName()); - } - - public void when() throws FileExistsException, FileNotFoundException - { - fileFolderService.move(document1, rmCategory, GUID.generate()); - } - }); - } - - public void testMoveDocumentInFolderInRmSite() - { - doBehaviourDrivenTest(new BehaviourDrivenTest(user) - { - private NodeRef folder1; - private NodeRef document1; - private String document1Name = GUID.generate(); - private NodeRef rmCategory; - private NodeRef rmFolder; - - public void given() - { - folder1 = fileFolderService.create(documentLibrary, GUID.generate(), ContentModel.TYPE_FOLDER).getNodeRef(); - document1 = fileFolderService.create(folder1, document1Name, ContentModel.TYPE_CONTENT).getNodeRef(); - - runAs(new RunAsWork() - { - public Void doWork() throws Exception - { - rmCategory = filePlanService.createRecordCategory(filePlan, GUID.generate()); - rmFolder = recordFolderService.createRecordFolder(rmCategory, GUID.generate()); - - return null; - } - }, getAdminUserName()); - } - - public void when() throws FileExistsException, FileNotFoundException - { - runAs(new RunAsWork() - { - public Void doWork() throws Exception - { - filePlanPermissionService.setPermission(rmFolder, user, RMPermissionModel.FILING); - - return null; - } - }, getAdminUserName()); - - fileFolderService.move(document1, rmFolder, null); - } - - public void then() - { - List folder1ChildAssocs = nodeService.getChildAssocs(folder1); - assertEquals(0, folder1ChildAssocs.size()); - - List rmFolderChildAssocs = nodeService.getChildAssocs(rmFolder); - assertEquals(1, rmFolderChildAssocs.size()); - NodeRef movedDocument = rmFolderChildAssocs.iterator().next().getChildRef(); - String movedDocumentName = (String) nodeService.getProperty(movedDocument, ContentModel.PROP_NAME); - assertEquals(document1Name, movedDocumentName); - } - }); - } - - public void testMoveFolderInFilePlanInRmSite() - { - doBehaviourDrivenTest(new BehaviourDrivenTest(AlfrescoRuntimeException.class, user) - { - private NodeRef folder1; - - public void given() - { - folder1 = fileFolderService.create(documentLibrary, GUID.generate(), ContentModel.TYPE_FOLDER).getNodeRef(); - } - - public void when() throws FileExistsException, FileNotFoundException - { - fileFolderService.move(folder1, filePlan, GUID.generate()); - } - }); - } - - public void testMoveFolderInCategoryInRmSite() - { - doBehaviourDrivenTest(new BehaviourDrivenTest(AlfrescoRuntimeException.class, user) - { - private NodeRef folder1; - private NodeRef rmCategory; - - public void given() - { - folder1 = fileFolderService.create(documentLibrary, GUID.generate(), ContentModel.TYPE_FOLDER).getNodeRef(); - - runAs(new RunAsWork() - { - public Void doWork() throws Exception - { - rmCategory = filePlanService.createRecordCategory(filePlan, GUID.generate()); - - return null; - } - }, getAdminUserName()); - } - - public void when() throws FileExistsException, FileNotFoundException - { - fileFolderService.move(folder1, rmCategory, GUID.generate()); - } - }); - } - - public void testMoveFolderInFolderInRmSite() - { - doBehaviourDrivenTest(new BehaviourDrivenTest(AlfrescoRuntimeException.class, user) - { - private NodeRef folder1; - private NodeRef rmCategory; - private NodeRef rmFolder; - - public void given() - { - folder1 = fileFolderService.create(documentLibrary, GUID.generate(), ContentModel.TYPE_FOLDER).getNodeRef(); - - runAs(new RunAsWork() - { - public Void doWork() throws Exception - { - rmCategory = filePlanService.createRecordCategory(filePlan, GUID.generate()); - rmFolder = recordFolderService.createRecordFolder(rmCategory, GUID.generate()); - - return null; - } - }, getAdminUserName()); - } - - public void when() throws FileExistsException, FileNotFoundException - { - fileFolderService.move(folder1, rmFolder, GUID.generate()); - } - }); - } - - public void testCopyDocumentToFolderInCollabSite() - { - doBehaviourDrivenTest(new BehaviourDrivenTest(user) - { - private NodeRef folder1; - private NodeRef folder2; - private NodeRef document1; - private String document1Name = GUID.generate(); - - public void given() - { - folder1 = fileFolderService.create(documentLibrary, GUID.generate(), ContentModel.TYPE_FOLDER).getNodeRef(); - document1 = fileFolderService.create(folder1, document1Name, ContentModel.TYPE_CONTENT).getNodeRef(); - folder2 = fileFolderService.create(documentLibrary, GUID.generate(), ContentModel.TYPE_FOLDER).getNodeRef(); - } - - public void when() throws FileExistsException, FileNotFoundException - { - fileFolderService.copy(document1, folder2, null); - } - - public void then() - { - List folder1ChildAssocs = nodeService.getChildAssocs(folder1); - assertEquals(1, folder1ChildAssocs.size()); - - List folder2ChildAssocs = nodeService.getChildAssocs(folder2); - assertNotNull(folder2ChildAssocs); - assertEquals(1, folder2ChildAssocs.size()); - NodeRef movedDocument = folder2ChildAssocs.iterator().next().getChildRef(); - String movedDocumentName = (String) nodeService.getProperty(movedDocument, ContentModel.PROP_NAME); - assertEquals(document1Name, movedDocumentName); - } - }); - } - - public void testCopyDocumentToDocumentLibraryInCollabSite() - { - doBehaviourDrivenTest(new BehaviourDrivenTest(user) - { - private NodeRef folder1; - private NodeRef document1; - private String document1Name = GUID.generate(); - - public void given() - { - folder1 = fileFolderService.create(documentLibrary, GUID.generate(), ContentModel.TYPE_FOLDER).getNodeRef(); - document1 = fileFolderService.create(folder1, document1Name, ContentModel.TYPE_CONTENT).getNodeRef(); - } - - public void when() throws FileExistsException, FileNotFoundException - { - fileFolderService.copy(document1, documentLibrary, null); - } - - public void then() - { - List folder1ChildAssocs = nodeService.getChildAssocs(folder1); - assertEquals(1, folder1ChildAssocs.size()); - - List childAssocs = nodeService.getChildAssocs(documentLibrary); - assertNotNull(childAssocs); - - List childNames = new ArrayList(); - for (ChildAssociationRef childAssociationRef : childAssocs) - { - NodeRef childRef = childAssociationRef.getChildRef(); - childNames.add((String) nodeService.getProperty(childRef, ContentModel.PROP_NAME)); - } - - assertTrue(childNames.contains(document1Name)); - } - }); - } - - public void testCopyFolderToFolderInCollabSite() - { - doBehaviourDrivenTest(new BehaviourDrivenTest(user) - { - private NodeRef folder1; - private NodeRef folder2; - private String folder1Name = GUID.generate(); - - public void given() - { - folder1 = fileFolderService.create(documentLibrary, folder1Name, ContentModel.TYPE_FOLDER).getNodeRef(); - folder2 = fileFolderService.create(documentLibrary, GUID.generate(), ContentModel.TYPE_FOLDER).getNodeRef(); - } - - public void when() throws FileExistsException, FileNotFoundException - { - fileFolderService.copy(folder1, folder2, null); - } - - public void then() - { - List folder2ChildAssocs = nodeService.getChildAssocs(folder2); - assertEquals(1, folder2ChildAssocs.size()); - NodeRef movedFolder = folder2ChildAssocs.iterator().next().getChildRef(); - String movedDocumentName = (String) nodeService.getProperty(movedFolder, ContentModel.PROP_NAME); - assertEquals(folder1Name, movedDocumentName); - } - }); - } - - public void testCopyDocumentToFolderInDifferentCollabSite() - { - doBehaviourDrivenTest(new BehaviourDrivenTest(user) - { - private NodeRef folder1; - private NodeRef folder2; - private NodeRef document1; - private String document1Name = GUID.generate(); - - public void given() - { - folder1 = fileFolderService.create(documentLibrary, GUID.generate(), ContentModel.TYPE_FOLDER).getNodeRef(); - document1 = fileFolderService.create(folder1, document1Name, ContentModel.TYPE_CONTENT).getNodeRef(); - folder2 = fileFolderService.create(documentLibrary2, GUID.generate(), ContentModel.TYPE_FOLDER).getNodeRef(); - } - - public void when() throws FileExistsException, FileNotFoundException - { - fileFolderService.copy(document1, folder2, null); - } - - public void then() - { - List folder1ChildAssocs = nodeService.getChildAssocs(folder1); - assertEquals(1, folder1ChildAssocs.size()); - - List folder2ChildAssocs = nodeService.getChildAssocs(folder2); - assertNotNull(folder2ChildAssocs); - assertEquals(1, folder2ChildAssocs.size()); - NodeRef movedDocument = folder2ChildAssocs.iterator().next().getChildRef(); - String movedDocumentName = (String) nodeService.getProperty(movedDocument, ContentModel.PROP_NAME); - assertEquals(document1Name, movedDocumentName); - } - }); - } - - public void testCopyDocumentToDocumentLibraryInDifferentCollabSite() - { - doBehaviourDrivenTest(new BehaviourDrivenTest(user) - { - private NodeRef folder1; - private NodeRef document1; - private String document1Name = GUID.generate(); - - public void given() - { - folder1 = fileFolderService.create(documentLibrary, GUID.generate(), ContentModel.TYPE_FOLDER).getNodeRef(); - document1 = fileFolderService.create(folder1, document1Name, ContentModel.TYPE_CONTENT).getNodeRef(); - } - - public void when() throws FileExistsException, FileNotFoundException - { - fileFolderService.copy(document1, documentLibrary2, null); - } - - public void then() - { - List folder1ChildAssocs = nodeService.getChildAssocs(folder1); - assertEquals(1, folder1ChildAssocs.size()); - - List childAssocs = nodeService.getChildAssocs(documentLibrary2); - assertNotNull(childAssocs); - - List childNames = new ArrayList(); - for (ChildAssociationRef childAssociationRef : childAssocs) - { - NodeRef childRef = childAssociationRef.getChildRef(); - childNames.add((String) nodeService.getProperty(childRef, ContentModel.PROP_NAME)); - } - - assertTrue(childNames.contains(document1Name)); - } - }); - } - - public void testCopyFolderToFolderInDifferentCollabSite() - { - doBehaviourDrivenTest(new BehaviourDrivenTest(user) - { - private NodeRef folder1; - private NodeRef folder2; - private String folder1Name = GUID.generate(); - - public void given() - { - folder1 = fileFolderService.create(documentLibrary, folder1Name, ContentModel.TYPE_FOLDER).getNodeRef(); - folder2 = fileFolderService.create(documentLibrary2, GUID.generate(), ContentModel.TYPE_FOLDER).getNodeRef(); - } - - public void when() throws FileExistsException, FileNotFoundException - { - fileFolderService.copy(folder1, folder2, null); - } - - public void then() - { - List folder2ChildAssocs = nodeService.getChildAssocs(folder2); - assertEquals(1, folder2ChildAssocs.size()); - NodeRef movedFolder = folder2ChildAssocs.iterator().next().getChildRef(); - String movedDocumentName = (String) nodeService.getProperty(movedFolder, ContentModel.PROP_NAME); - assertEquals(folder1Name, movedDocumentName); - } - }); - } - - public void testCopyDocumentInFilePlanInRmSite() - { - doBehaviourDrivenTest(new BehaviourDrivenTest(AlfrescoRuntimeException.class, user) - { - private NodeRef folder1; - private NodeRef document1; - - public void given() - { - folder1 = fileFolderService.create(documentLibrary, GUID.generate(), ContentModel.TYPE_FOLDER).getNodeRef(); - document1 = fileFolderService.create(folder1, GUID.generate(), ContentModel.TYPE_CONTENT).getNodeRef(); - } - - public void when() throws FileExistsException, FileNotFoundException - { - fileFolderService.copy(document1, filePlan, GUID.generate()); - } - }); - } - - public void testCopyDocumentInCategoryInRmSite() - { - doBehaviourDrivenTest(new BehaviourDrivenTest(AlfrescoRuntimeException.class, user) - { - private NodeRef folder1; - private NodeRef document1; - private NodeRef rmCategory; - - public void given() - { - folder1 = fileFolderService.create(documentLibrary, GUID.generate(), ContentModel.TYPE_FOLDER).getNodeRef(); - document1 = fileFolderService.create(folder1, GUID.generate(), ContentModel.TYPE_CONTENT).getNodeRef(); - - runAs(new RunAsWork() - { - public Void doWork() throws Exception - { - rmCategory = filePlanService.createRecordCategory(filePlan, GUID.generate()); - - return null; - } - }, getAdminUserName()); - } - - public void when() throws FileExistsException, FileNotFoundException - { - fileFolderService.copy(document1, rmCategory, GUID.generate()); - } - }); - } - - public void testCopyDocumentInFolderInRmSite() - { - doBehaviourDrivenTest(new BehaviourDrivenTest(AlfrescoRuntimeException.class, user) - { - private NodeRef folder1; - private NodeRef document1; - private String document1Name = GUID.generate(); - private NodeRef rmCategory; - private NodeRef rmFolder; - - public void given() - { - folder1 = fileFolderService.create(documentLibrary, GUID.generate(), ContentModel.TYPE_FOLDER).getNodeRef(); - document1 = fileFolderService.create(folder1, document1Name, ContentModel.TYPE_CONTENT).getNodeRef(); - - runAs(new RunAsWork() - { - public Void doWork() throws Exception - { - rmCategory = filePlanService.createRecordCategory(filePlan, GUID.generate()); - rmFolder = recordFolderService.createRecordFolder(rmCategory, GUID.generate()); - - return null; - } - }, getAdminUserName()); - } - - public void when() throws FileExistsException, FileNotFoundException - { - runAs(new RunAsWork() - { - public Void doWork() throws Exception - { - filePlanPermissionService.setPermission(rmFolder, user, RMPermissionModel.FILING); - - return null; - } - }, getAdminUserName()); - - fileFolderService.copy(document1, rmFolder, null); - } - }); - } - - public void testCopyFolderInFilePlanInRmSite() - { - doBehaviourDrivenTest(new BehaviourDrivenTest(AlfrescoRuntimeException.class, user) - { - private NodeRef folder1; - - public void given() - { - folder1 = fileFolderService.create(documentLibrary, GUID.generate(), ContentModel.TYPE_FOLDER).getNodeRef(); - } - - public void when() throws FileExistsException, FileNotFoundException - { - fileFolderService.copy(folder1, filePlan, GUID.generate()); - } - }); - } - - public void testCopyFolderInCategoryInRmSite() - { - doBehaviourDrivenTest(new BehaviourDrivenTest(AlfrescoRuntimeException.class, user) - { - private NodeRef folder1; - private NodeRef rmCategory; - - public void given() - { - folder1 = fileFolderService.create(documentLibrary, GUID.generate(), ContentModel.TYPE_FOLDER).getNodeRef(); - - runAs(new RunAsWork() - { - public Void doWork() throws Exception - { - rmCategory = filePlanService.createRecordCategory(filePlan, GUID.generate()); - - return null; - } - }, getAdminUserName()); - } - - public void when() throws FileExistsException, FileNotFoundException - { - fileFolderService.copy(folder1, rmCategory, GUID.generate()); - } - }); - } - - public void testCopyFolderInFolderInRmSite() - { - doBehaviourDrivenTest(new BehaviourDrivenTest(AlfrescoRuntimeException.class, user) - { - private NodeRef folder1; - private NodeRef rmCategory; - private NodeRef rmFolder; - - public void given() - { - folder1 = fileFolderService.create(documentLibrary, GUID.generate(), ContentModel.TYPE_FOLDER).getNodeRef(); - - runAs(new RunAsWork() - { - public Void doWork() throws Exception - { - rmCategory = filePlanService.createRecordCategory(filePlan, GUID.generate()); - rmFolder = recordFolderService.createRecordFolder(rmCategory, GUID.generate()); - - return null; - } - }, getAdminUserName()); - } - - public void when() throws FileExistsException, FileNotFoundException - { - fileFolderService.copy(folder1, rmFolder, GUID.generate()); - } - }); - } -} diff --git a/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/job/AutomaticDispositionTest.java b/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/job/AutomaticDispositionTest.java index d2491dcd28..55ad57c978 100644 --- a/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/job/AutomaticDispositionTest.java +++ b/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/job/AutomaticDispositionTest.java @@ -30,11 +30,11 @@ import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase; import org.alfresco.module.org_alfresco_module_rm.test.util.CommonRMTestUtils; import org.alfresco.service.cmr.repository.NodeRef; import org.alfresco.service.namespace.QName; -import org.alfresco.util.GUID; +import org.springframework.extensions.webscripts.GUID; /** * Test automatic disposition via scheduled job. - * + * * @author Roy Wetherall * @since 2.2 */ @@ -42,7 +42,7 @@ public class AutomaticDispositionTest extends BaseRMTestCase { @SuppressWarnings("unused") private RecordsManagementAuditService auditService; - + /** additional job context to override job frequency */ protected String[] getConfigLocations() { @@ -53,17 +53,17 @@ public class AutomaticDispositionTest extends BaseRMTestCase "classpath:test-job-context.xml" }; } - + /** * @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase#initServices() */ @Override protected void initServices() { - super.initServices(); + super.initServices(); auditService = (RecordsManagementAuditService)applicationContext.getBean("recordsManagementAuditService"); } - + /** * Given there is a complete record eligible for cut off, when the correct frequency of time passes, then * the record will be automatically cut off @@ -71,62 +71,61 @@ public class AutomaticDispositionTest extends BaseRMTestCase public void testAutomaticCutOff() { doBehaviourDrivenTest(new BehaviourDrivenTest() - { + { NodeRef sourceCategory; NodeRef sourceRecordFolder; - NodeRef record; - + NodeRef record; + public void given() - { + { // create test data - sourceCategory = filePlanService.createRecordCategory(filePlan, GUID.generate()); + sourceCategory = filePlanService.createRecordCategory(filePlan, GUID.generate()); DispositionSchedule dis = utils.createBasicDispositionSchedule(sourceCategory, GUID.generate(), GUID.generate(), true, false); Map adParams = new HashMap(3); adParams.put(PROP_DISPOSITION_ACTION_NAME, CutOffAction.NAME); adParams.put(PROP_DISPOSITION_DESCRIPTION, GUID.generate()); adParams.put(PROP_DISPOSITION_PERIOD, CommonRMTestUtils.PERIOD_IMMEDIATELY); - dispositionService.addDispositionActionDefinition(dis, adParams); + dispositionService.addDispositionActionDefinition(dis, adParams); sourceRecordFolder = recordFolderService.createRecordFolder(sourceCategory, GUID.generate()); // create and complete record record = utils.createRecord(sourceRecordFolder, GUID.generate()); utils.completeRecord(record); - + // check the disposition action details DispositionAction dispositionAction = dispositionService.getNextDispositionAction(record); assertNotNull(dispositionAction); assertNotNull(CutOffAction.NAME, dispositionAction.getName()); - assertTrue(dispositionService.isNextDispositionActionEligible(record)); + assertTrue(dispositionService.isNextDispositionActionEligible(record)); } - + public void when() throws Exception - { + { // sleep .. allowing the job time to execute - Thread.sleep(30000); + Thread.sleep(30000); } - + public void then() { // record should now be cut off assertTrue(dispositionService.isDisposableItemCutoff(record)); - - // TODO .. automatic dispoistion does not log entry in audit - // .. the following test checks for this, but is currently commented out - // .. because it doesn't work! -// RecordsManagementAuditQueryParameters params = new RecordsManagementAuditQueryParameters(); -// params.setEvent(CutOffAction.NAME); -// params.setMaxEntries(1); -// List entries = auditService.getAuditTrail(params); -// assertNotNull(entries); -// assertEquals(1, entries.size()); -// -// RecordsManagementAuditEntry entry = entries.get(0); -// assertEquals(record, entry.getNodeRef()); - } - }); + + // TODO uncomment and ensure is working + + //RecordsManagementAuditQueryParameters params = new RecordsManagementAuditQueryParameters(); + //params.setEvent(CutOffAction.NAME); + //params.setMaxEntries(1); + //List entries = auditService.getAuditTrail(params); + //assertNotNull(entries); + //assertEquals(1, entries.size()); + + //RecordsManagementAuditEntry entry = entries.get(0); + //assertEquals(record, entry.getNodeRef()); + } + }); } - + // TODO automatic retain - + // TODO automatic destroy } diff --git a/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/record/CompleteRecordTest.java b/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/record/CompleteRecordTest.java new file mode 100644 index 0000000000..c86a12e277 --- /dev/null +++ b/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/record/CompleteRecordTest.java @@ -0,0 +1,233 @@ +/* + * Copyright (C) 2005-2014 Alfresco Software Limited. + * + * This file is part of Alfresco + * + * Alfresco is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Alfresco is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + */ +package org.alfresco.module.org_alfresco_module_rm.test.integration.record; + +import java.io.Serializable; +import java.util.HashMap; +import java.util.Map; + +import org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementActionResult; +import org.alfresco.module.org_alfresco_module_rm.action.impl.DeclareRecordAction; +import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase; +import org.alfresco.service.cmr.repository.NodeRef; +import org.alfresco.service.namespace.QName; + +/** + * Complete record tests. + * + * @author Roy Wetherall + * @since 2.2.1 + */ +public class CompleteRecordTest extends BaseRMTestCase +{ + private static final QName ASPECT_TEST = QName.createQName("http://www.alfresco.org/model/rmtest/1.0", "recordMetaDataWithProperty"); + private static final QName PROP_TEST = QName.createQName("http://www.alfresco.org/model/rmtest/1.0", "customMandatoryProperty"); + + /** complete record action */ + private DeclareRecordAction action; + + /** + * @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase#initServices() + */ + @Override + protected void initServices() + { + super.initServices(); + + // get the action + action = (DeclareRecordAction)applicationContext.getBean("declareRecord"); + } + + /** + * @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase#tearDownImpl() + */ + @Override + protected void tearDownImpl() + { + super.tearDownImpl(); + + // ensure action is returned to original state + action.setCheckMandatoryPropertiesEnabled(true); + } + + /** + * Given the the application is configured to check for mandatory values before complete + * And a filed record is missing mandatory values + * When I try to complete the record + * Then the missing properties parameter of the action will be populated + * And the record will not be complete + */ + public void testCheckForMandatoryValuesMissing() throws Exception + { + doBehaviourDrivenTest(new BehaviourDrivenTest() + { + private NodeRef record; + private RecordsManagementActionResult result; + + public void given() + { + // enable mandatory parameter check + action.setCheckMandatoryPropertiesEnabled(true); + + // create a record + record = utils.createRecord(rmFolder, "record.txt", "title"); + + // add the record aspect (that has a mandatory property) + nodeService.addAspect(record, ASPECT_TEST, null); + } + + public void when() + { + // complete record + result = rmActionService.executeRecordsManagementAction(record, "declareRecord"); + } + + public void then() + { + assertNotNull(result); + assertNotNull(result.getValue()); + assertFalse(nodeService.hasAspect(record, ASPECT_DECLARED_RECORD)); + } + }); + } + + /** + * Given the the application is configured to check for mandatory values before complete + * And a filed record has all mandatory values + * When I try to complete the record + * Then the record is completed + */ + public void testCheckForMandatoryValuePresent() throws Exception + { + doBehaviourDrivenTest(new BehaviourDrivenTest() + { + private NodeRef record; + private RecordsManagementActionResult result; + + public void given() + { + // enable mandatory parameter check + action.setCheckMandatoryPropertiesEnabled(true); + + // create a record + record = utils.createRecord(rmFolder, "record.txt", "title"); + + // add the record aspect (that has a mandatory property) + Map properties = new HashMap(1); + properties.put(PROP_TEST, "something"); + nodeService.addAspect(record, ASPECT_TEST, properties); + } + + public void when() + { + // complete record + result = rmActionService.executeRecordsManagementAction(record, "declareRecord"); + } + + public void then() + { + assertNotNull(result); + assertNull(result.getValue()); + assertTrue(nodeService.hasAspect(record, ASPECT_DECLARED_RECORD)); + } + }); + } + + /** + * Given the the application is configured not to check for mandatory values before complete + * And a filed record is missing mandatory values + * When I try to complete the record + * Then the record is completed + */ + public void testDontCheckForMandatoryValuesMissing() throws Exception + { + doBehaviourDrivenTest(new BehaviourDrivenTest() + { + private NodeRef record; + private RecordsManagementActionResult result; + + public void given() + { + // disable mandatory parameter check + action.setCheckMandatoryPropertiesEnabled(false); + + // create a record + record = utils.createRecord(rmFolder, "record.txt", "title"); + + // add the record aspect (that has a mandatory property) + nodeService.addAspect(record, ASPECT_TEST, null); + } + + public void when() + { + // complete record + result = rmActionService.executeRecordsManagementAction(record, "declareRecord"); + } + + public void then() + { + assertNotNull(result); + assertNull(result.getValue()); + assertTrue(nodeService.hasAspect(record, ASPECT_DECLARED_RECORD)); + } + }); + } + + /** + * Given the the application is configured to not to check for mandatory values before complete + * And a filed record has all mandatory values + * When I try to complete the record + * Then the record is completed + */ + public void testDontCheckForMandatoryValuePresent() throws Exception + { + doBehaviourDrivenTest(new BehaviourDrivenTest() + { + private NodeRef record; + private RecordsManagementActionResult result; + + public void given() + { + // enable mandatory parameter check + action.setCheckMandatoryPropertiesEnabled(false); + + // create a record + record = utils.createRecord(rmFolder, "record.txt", "title"); + + // add the record aspect (that has a mandatory property) + Map properties = new HashMap(1); + properties.put(PROP_TEST, "something"); + nodeService.addAspect(record, ASPECT_TEST, properties); + } + + public void when() + { + // complete record + result = rmActionService.executeRecordsManagementAction(record, "declareRecord"); + } + + public void then() + { + assertNotNull(result); + assertNull(result.getValue()); + assertTrue(nodeService.hasAspect(record, ASPECT_DECLARED_RECORD)); + } + }); + } +} diff --git a/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/record/CreateRecordTest.java b/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/record/CreateRecordTest.java index fa9162ea48..8ebcbea4f8 100644 --- a/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/record/CreateRecordTest.java +++ b/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/record/CreateRecordTest.java @@ -28,30 +28,28 @@ import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase; import org.alfresco.repo.content.MimetypeMap; import org.alfresco.repo.security.authentication.AuthenticationUtil; import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork; -import org.alfresco.repo.security.permissions.AccessDeniedException; -import org.alfresco.service.cmr.repository.ContentData; import org.alfresco.service.cmr.repository.ContentWriter; import org.alfresco.service.cmr.repository.NodeRef; import org.alfresco.util.GUID; /** * Create record tests. - * + * * @author Roy Wetherall * @since 2.2 */ public class CreateRecordTest extends BaseRMTestCase -{ +{ public void testCreateRecordCapabilityOnly() throws Exception { doBehaviourDrivenTest(new BehaviourDrivenTest() { /** test data */ String roleName = GUID.generate(); - String user = GUID.generate(); + String user = GUID.generate(); NodeRef recordFolder; NodeRef record; - + public void given() { // create role @@ -59,42 +57,42 @@ public class CreateRecordTest extends BaseRMTestCase capabilities.add(capabilityService.getCapability("ViewRecords")); capabilities.add(capabilityService.getCapability("CreateRecords")); filePlanRoleService.createRole(filePlan, roleName, roleName, capabilities); - + // create user and assign to role - createPerson(user, true); + createPerson(user, true); filePlanRoleService.assignRoleToAuthority(filePlan, roleName, user); - + // create file plan structure NodeRef rc = filePlanService.createRecordCategory(filePlan, GUID.generate()); recordFolder = recordFolderService.createRecordFolder(rc, GUID.generate()); } - + public void when() { // give read and file permissions to user filePlanPermissionService.setPermission(recordFolder, user, RMPermissionModel.FILING); - + AuthenticationUtil.runAs(new RunAsWork() { public Void doWork() throws Exception { record = recordService.createRecordFromContent(recordFolder, GUID.generate(), TYPE_CONTENT, null, null); - + return null; } - }, user); + }, user); } - + public void then() { // check the details of the record assertTrue(recordService.isRecord(record)); } - }); + }); } - + /** - * + * @see */ public void testCreateRecordCapabilityOnlyFromFileFolderService() throws Exception { @@ -102,10 +100,10 @@ public class CreateRecordTest extends BaseRMTestCase { /** test data */ String roleName = GUID.generate(); - String user = GUID.generate(); + String user = GUID.generate(); NodeRef recordFolder; NodeRef record; - + public void given() { // create role @@ -113,175 +111,42 @@ public class CreateRecordTest extends BaseRMTestCase capabilities.add(capabilityService.getCapability("ViewRecords")); capabilities.add(capabilityService.getCapability("CreateRecords")); filePlanRoleService.createRole(filePlan, roleName, roleName, capabilities); - + // create user and assign to role - createPerson(user, true); + createPerson(user, true); filePlanRoleService.assignRoleToAuthority(filePlan, roleName, user); - + // create file plan structure NodeRef rc = filePlanService.createRecordCategory(filePlan, GUID.generate()); recordFolder = recordFolderService.createRecordFolder(rc, GUID.generate()); } - + public void when() { // give read and file permissions to user filePlanPermissionService.setPermission(recordFolder, user, RMPermissionModel.FILING); - + AuthenticationUtil.runAs(new RunAsWork() { public Void doWork() throws Exception { record = fileFolderService.create(recordFolder, GUID.generate(), ContentModel.TYPE_CONTENT).getNodeRef(); - + ContentWriter writer = contentService.getWriter(record, ContentModel.TYPE_CONTENT, true); writer.setMimetype(MimetypeMap.MIMETYPE_TEXT_PLAIN); writer.setEncoding("UTF-8"); writer.putContent("Lucy Wetherall"); - - return null; - } - }, user); - } - - public void then() - { - // check the details of the record - assertTrue(recordService.isRecord(record)); - } - }); - } - - /** - * unit test for RM1649 fix - * test if a user with create record permissions and without file record permission is able to create a record within unfiled record container - */ - public void testCreateRecordCapabilityInsideUnfiledRecordsContainer() throws Exception - { - doBehaviourDrivenTest(new BehaviourDrivenTest() - { - /** test data */ - String roleName = GUID.generate(); - String user = GUID.generate(); - NodeRef record; - - public void given() - { - // create a role with view and create capabilities - Set capabilities = new HashSet(2); - capabilities.add(capabilityService.getCapability("ViewRecords")); - capabilities.add(capabilityService.getCapability("CreateRecords")); - filePlanRoleService.createRole(filePlan, roleName, roleName, capabilities); - - - // create user and assign to role - createPerson(user, true); - filePlanRoleService.assignRoleToAuthority(filePlan, roleName, user); - - //give read and file permission to user on unfiled records container - filePlanPermissionService.setPermission(unfiledContainer , user, RMPermissionModel.FILING); - } - - public void when() - { - AuthenticationUtil.runAs(new RunAsWork() - { - public Void doWork() throws Exception - { - record = recordService.createRecordFromContent(unfiledContainer, GUID.generate(), TYPE_CONTENT, null, null); - - return null; - } - }, user); - } - - public void then() - { - // check the details of the record - assertTrue(recordService.isRecord(record)); - - } - }); - } - - /** - * Given I have ViewRecord and CreateRecord capabilities - * And I have filling on a record folder - * When I create content via ScriptNode (simulated) - * Then the record is successfully created - * - * @see https://issues.alfresco.com/jira/browse/RM-1956 - */ - public void testCreateRecordViaCoreServices() throws Exception - { - doBehaviourDrivenTest(new BehaviourDrivenTest() - { - /** test data */ - String roleName = GUID.generate(); - String user = GUID.generate(); - NodeRef recordFolder; - NodeRef record; - - public void given() - { - // create a role with view and create capabilities - Set capabilities = new HashSet(2); - capabilities.add(capabilityService.getCapability("ViewRecords")); - capabilities.add(capabilityService.getCapability("CreateRecords")); - filePlanRoleService.createRole(filePlan, roleName, roleName, capabilities); - - // create user and assign to role - createPerson(user, true); - filePlanRoleService.assignRoleToAuthority(filePlan, roleName, user); - - // create file plan structure - NodeRef rc = filePlanService.createRecordCategory(filePlan, GUID.generate()); - recordFolder = recordFolderService.createRecordFolder(rc, GUID.generate()); - } - - public void when() - { - // give read and file permissions to user - filePlanPermissionService.setPermission(recordFolder, user, RMPermissionModel.FILING); - - record = AuthenticationUtil.runAs(new RunAsWork() - { - public NodeRef doWork() throws Exception - { - NodeRef record = fileFolderService.create(recordFolder, "testRecord.txt", ContentModel.TYPE_CONTENT).getNodeRef(); - ContentData content = (ContentData)nodeService.getProperty(record, PROP_CONTENT); - nodeService.setProperty(record, PROP_CONTENT, ContentData.setMimetype(content, MimetypeMap.MIMETYPE_TEXT_PLAIN)); - return record; - } - }, user); - } - - public void then() - { - // check the details of the record - assertTrue(recordService.isRecord(record)); - - AuthenticationUtil.runAs(new RunAsWork() - { - public Void doWork() throws Exception - { - // we are expecting an expception here - try - { - ContentData content = (ContentData)nodeService.getProperty(record, PROP_CONTENT); - nodeService.setProperty(record, PROP_CONTENT, ContentData.setMimetype(content, MimetypeMap.MIMETYPE_TEXT_PLAIN)); - fail("Expecting access denied exception"); - } - catch (AccessDeniedException exception) - { - // expceted - } return null; } - }, user); + }, user); } - - }); - } + + public void then() + { + // check the details of the record + assertTrue(recordService.isRecord(record)); + } + }); + } } diff --git a/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/record/HideInplaceRecordTest.java b/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/record/HideInplaceRecordTest.java deleted file mode 100644 index 5ca049d849..0000000000 --- a/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/record/HideInplaceRecordTest.java +++ /dev/null @@ -1,98 +0,0 @@ -/* - * Copyright (C) 2005-2014 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - */ -package org.alfresco.module.org_alfresco_module_rm.test.integration.record; - -import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase; -import org.alfresco.repo.security.authentication.AuthenticationUtil; -import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork; - -/** - * Hide Inplace Record Test - * - * @author Tuna Aksoy - * @since 2.3 - */ -public class HideInplaceRecordTest extends BaseRMTestCase -{ - /** - * @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase#isCollaborationSiteTest() - */ - @Override - protected boolean isCollaborationSiteTest() - { - return true; - } - - /** - * Tests hiding inplace records - */ - public void testHideInplaceRecord() - { - doBehaviourDrivenTest(new BehaviourDrivenTest() - { - public void given() - { - // Check that the document is not a record - assertFalse(recordService.isRecord(dmDocument)); - - // Check that the record has one parent association - assertEquals(1, nodeService.getParentAssocs(dmDocument).size()); - - // Declare the document as a record - AuthenticationUtil.runAs(new RunAsWork() - { - public Void doWork() throws Exception - { - // Declare record - recordService.createRecord(filePlan, dmDocument); - - return null; - } - }, dmCollaborator); - - // Check that the document is a record - assertTrue(recordService.isRecord(dmDocument)); - - // Check that the record has two parent associations - assertEquals(2, nodeService.getParentAssocs(dmDocument).size()); - } - - public void when() - { - // Hide the document - AuthenticationUtil.runAs(new RunAsWork() - { - public Void doWork() throws Exception - { - // Hide record - inplaceRecordService.hideRecord(dmDocument); - - return null; - } - }, dmCollaborator); - } - - public void then() - { - // Check that the record has one parent association - assertEquals(1, nodeService.getParentAssocs(dmDocument).size()); - } - }); - } -} diff --git a/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/record/LinkRecordTest.java b/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/record/LinkRecordTest.java deleted file mode 100644 index df22b25f2b..0000000000 --- a/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/record/LinkRecordTest.java +++ /dev/null @@ -1,156 +0,0 @@ -/* - * Copyright (C) 2005-2014 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - */ -package org.alfresco.module.org_alfresco_module_rm.test.integration.record; - -import java.util.List; - -import org.alfresco.error.AlfrescoRuntimeException; -import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase; -import org.alfresco.service.cmr.repository.ChildAssociationRef; -import org.alfresco.service.cmr.repository.NodeRef; -import org.springframework.extensions.webscripts.GUID; - -/** - * Link/Unlink Record Tests - * - * @author Roy Wetherall - * @since 2.3 - */ -public class LinkRecordTest extends BaseRMTestCase -{ - @Override - protected boolean isUserTest() - { - return true; - } - - @Override - protected boolean isCollaborationSiteTest() - { - return true; - } - - @Override - protected void initServices() - { - super.initServices(); - } - - /** - * Given source and destination disposition schedules are compatible - * When I link a record to the record folder - * Then it is successful - */ - public void testLinkWithCompatibleDispositionSchedules() throws Exception - { - doBehaviourDrivenTest(new BehaviourDrivenTest() - { - private NodeRef sourceRecordCategory; - private NodeRef targetRecordCategory; - private NodeRef sourceRecordFolder; - private NodeRef targetRecordFolder; - private NodeRef myRecord; - - public void given() throws Exception - { - // test entities - sourceRecordCategory = filePlanService.createRecordCategory(filePlan, GUID.generate()); - sourceRecordFolder = recordFolderService.createRecordFolder(sourceRecordCategory, GUID.generate()); - myRecord = utils.createRecord(sourceRecordFolder, GUID.generate()); - targetRecordCategory = filePlanService.createRecordCategory(filePlan, GUID.generate()); - targetRecordFolder = recordFolderService.createRecordFolder(targetRecordCategory, GUID.generate()); - - // create disposition schedules on record folders - utils.createBasicDispositionSchedule( - sourceRecordCategory, - "disposition instructions", - "disposition authority", - false, - true); - utils.createBasicDispositionSchedule( - targetRecordCategory, - "disposition instructions", - "disposition authority", - false, - true); - } - - public void when() throws Exception - { - // link the record into the record folder - recordService.link(myRecord, targetRecordFolder); - } - - public void then() throws Exception - { - // assert that the record now has two parents - List assocs = nodeService.getParentAssocs(myRecord); - assertNotNull(assocs); - assertEquals(2, assocs.size()); - } - }); - } - - /** - * Given source and destination disposition schedules are incompatible - * When I link a record to the record folder - * Then it is fails - */ - public void testLinkWithIncompatibleDispositionSchedules() throws Exception - { - doBehaviourDrivenTest(new BehaviourDrivenTest(AlfrescoRuntimeException.class) - { - private NodeRef sourceRecordCategory; - private NodeRef targetRecordCategory; - private NodeRef sourceRecordFolder; - private NodeRef targetRecordFolder; - private NodeRef myRecord; - - public void given() throws Exception - { - // test entities - sourceRecordCategory = filePlanService.createRecordCategory(filePlan, GUID.generate()); - sourceRecordFolder = recordFolderService.createRecordFolder(sourceRecordCategory, GUID.generate()); - myRecord = utils.createRecord(sourceRecordFolder, GUID.generate()); - targetRecordCategory = filePlanService.createRecordCategory(filePlan, GUID.generate()); - targetRecordFolder = recordFolderService.createRecordFolder(targetRecordCategory, GUID.generate()); - - // create disposition schedules on record folders - utils.createBasicDispositionSchedule( - sourceRecordCategory, - "disposition instructions", - "disposition authority", - false, - true); - utils.createBasicDispositionSchedule( - targetRecordCategory, - "disposition instructions", - "disposition authority", - true, - true); - } - - public void when() throws Exception - { - // link the record into the record folder - recordService.link(myRecord, targetRecordFolder); - } - }); - } -} diff --git a/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/record/MoveInplaceRecordTest.java b/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/record/MoveInplaceRecordTest.java deleted file mode 100644 index 9c05652660..0000000000 --- a/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/record/MoveInplaceRecordTest.java +++ /dev/null @@ -1,126 +0,0 @@ -/* - * Copyright (C) 2005-2014 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - */ -package org.alfresco.module.org_alfresco_module_rm.test.integration.record; - -import static org.apache.commons.collections.ListUtils.removeAll; - -import java.util.List; -import java.util.Set; - -import org.alfresco.model.ContentModel; -import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase; -import org.alfresco.repo.security.authentication.AuthenticationUtil; -import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork; -import org.alfresco.service.cmr.repository.ChildAssociationRef; -import org.alfresco.service.cmr.repository.NodeRef; - -/** - * Move Inplace Record Test - * - * @author Tuna Aksoy - * @since 2.3 - */ -public class MoveInplaceRecordTest extends BaseRMTestCase -{ - /** - * @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase#isCollaborationSiteTest() - */ - @Override - protected boolean isCollaborationSiteTest() - { - return true; - } - - /** - * Tests moving inplace records - */ - public void testMoveInplaceRecord() - { - doBehaviourDrivenTest(new BehaviourDrivenTest() - { - // The destination folder in collaboration site - private NodeRef destinationDmFolder; - - // Extended Readers/Writers - private Set extendedReadersBeforeMove; - private Set extendedWritersBeforeMove; - - public void given() - { - // Create the destination folder - destinationDmFolder = fileFolderService.create(documentLibrary, "destinationCollabFolder", ContentModel.TYPE_FOLDER).getNodeRef(); - - // Check that the document is not a record - assertFalse(recordService.isRecord(dmDocument)); - - // Declare the document as a record - AuthenticationUtil.runAs(new RunAsWork() - { - public Void doWork() throws Exception - { - // Declare record - recordService.createRecord(filePlan, dmDocument); - - return null; - } - }, dmCollaborator); - - // Check that the document is a record now - assertTrue(recordService.isRecord(dmDocument)); - - extendedReadersBeforeMove = extendedSecurityService.getExtendedReaders(dmDocument); - extendedWritersBeforeMove = extendedSecurityService.getExtendedWriters(dmDocument); - } - - public void when() - { - // Move the document - AuthenticationUtil.runAs(new RunAsWork() - { - public Void doWork() throws Exception - { - // Move record - inplaceRecordService.moveRecord(dmDocument, destinationDmFolder); - - return null; - } - }, dmCollaborator); - } - - public void then() - { - // Check that the source folder is empty now and the destination folder has the document - assertEquals(0, nodeService.getChildAssocs(dmFolder).size()); - List destinationFolderChildAssocs = nodeService.getChildAssocs(destinationDmFolder); - assertEquals(1, destinationFolderChildAssocs.size()); - assertEquals(dmDocument, destinationFolderChildAssocs.get(0).getChildRef()); - - // Check extended readers/writers - Set extendedReadersAfterMove = extendedSecurityService.getExtendedReaders(dmDocument); - Set extendedWritersAfterMove = extendedSecurityService.getExtendedWriters(dmDocument); - - assertEquals(extendedReadersBeforeMove.size(), extendedReadersAfterMove.size()); - assertEquals(extendedWritersBeforeMove.size(), extendedWritersAfterMove.size()); - - assertEquals(0, removeAll(extendedReadersBeforeMove, extendedReadersAfterMove).size()); - assertEquals(0, removeAll(extendedWritersBeforeMove, extendedWritersAfterMove).size()); - } - }); - } -} diff --git a/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/record/RecordTestSuite.java b/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/record/RecordTestSuite.java index d2b3b8e498..241cdc7bd6 100644 --- a/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/record/RecordTestSuite.java +++ b/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/record/RecordTestSuite.java @@ -34,10 +34,7 @@ import org.junit.runners.Suite.SuiteClasses; RejectRecordTest.class, CreateRecordTest.class, MoveRecordTest.class, - HideInplaceRecordTest.class, - MoveInplaceRecordTest.class, - ViewRecordTest.class, - LinkRecordTest.class + CompleteRecordTest.class }) public class RecordTestSuite { diff --git a/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/record/RejectRecordTest.java b/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/record/RejectRecordTest.java index 05f80f6181..4aa12bd50c 100644 --- a/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/record/RejectRecordTest.java +++ b/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/record/RejectRecordTest.java @@ -18,34 +18,15 @@ */ package org.alfresco.module.org_alfresco_module_rm.test.integration.record; -import static org.alfresco.module.org_alfresco_module_rm.version.RecordableVersionModel.PROP_FILE_PLAN; -import static org.alfresco.module.org_alfresco_module_rm.version.RecordableVersionModel.PROP_RECORDABLE_VERSION_POLICY; -import static org.alfresco.service.cmr.version.VersionType.MINOR; -import static org.springframework.extensions.webscripts.GUID.generate; - -import java.io.Serializable; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Set; - import org.alfresco.model.ContentModel; -import org.alfresco.module.org_alfresco_module_rm.relationship.Relationship; import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase; -import org.alfresco.module.org_alfresco_module_rm.version.RecordableVersionModel; -import org.alfresco.module.org_alfresco_module_rm.version.RecordableVersionPolicy; import org.alfresco.repo.security.authentication.AuthenticationUtil; import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork; -import org.alfresco.repo.version.VersionModel; -import org.alfresco.service.cmr.coci.CheckOutCheckInService; -import org.alfresco.service.cmr.repository.ChildAssociationRef; import org.alfresco.service.cmr.repository.ContentWriter; import org.alfresco.service.cmr.repository.NodeRef; import org.alfresco.service.cmr.version.Version; import org.alfresco.service.cmr.version.VersionHistory; import org.alfresco.service.cmr.version.VersionService; -import org.alfresco.util.PropertyMap; -import org.springframework.extensions.surf.util.I18NUtil; import org.springframework.extensions.webscripts.GUID; /** @@ -57,10 +38,8 @@ import org.springframework.extensions.webscripts.GUID; public class RejectRecordTest extends BaseRMTestCase { private VersionService versionService; - private CheckOutCheckInService checkOutCheckInService; private static final String REASON = GUID.generate(); - private static final String FINAL_VERSION = "rm.service.final-version"; @Override protected boolean isUserTest() @@ -79,8 +58,7 @@ public class RejectRecordTest extends BaseRMTestCase { super.initServices(); - versionService = (VersionService) applicationContext.getBean("VersionService"); - checkOutCheckInService = (CheckOutCheckInService) applicationContext.getBean("CheckOutCheckInService"); + versionService = (VersionService)applicationContext.getBean("VersionService"); } /** @@ -113,7 +91,7 @@ public class RejectRecordTest extends BaseRMTestCase assertTrue(recordService.isRecord(dmDocument)); assertTrue(permissionService.getInheritParentPermissions(dmDocument)); - // reject record + // declare record recordService.rejectRecord(dmDocument, REASON); } @@ -136,7 +114,7 @@ public class RejectRecordTest extends BaseRMTestCase public void testRevertAfterReject() throws Exception { doBehaviourDrivenTest(new BehaviourDrivenTest() - { + {; private NodeRef document; public void given() @@ -211,83 +189,4 @@ public class RejectRecordTest extends BaseRMTestCase } }); } - - public void testRelationshipAfterRevertingRecord() - { - doBehaviourDrivenTest(new BehaviourDrivenTest() - { - // Test document - private NodeRef document; - - public void given() - { - // Create a test document - NodeRef folder = fileFolderService.create(documentLibrary, generate(), TYPE_FOLDER).getNodeRef(); - document = fileFolderService.create(folder, generate(), TYPE_CONTENT).getNodeRef(); - - // Set Auto-Declare Versions to "For all major and minor versions" - PropertyMap recordableVersionProperties = new PropertyMap(2); - recordableVersionProperties.put(PROP_RECORDABLE_VERSION_POLICY, RecordableVersionPolicy.ALL); - recordableVersionProperties.put(PROP_FILE_PLAN, filePlan); - nodeService.addAspect(document, ASPECT_VERSIONABLE, recordableVersionProperties); - - // Upload New Version - document = checkOutCheckInService.checkout(document); - Map props = new HashMap(2); - props.put(Version.PROP_DESCRIPTION, generate()); - props.put(VersionModel.PROP_VERSION_TYPE, MINOR); - document = checkOutCheckInService.checkin(document, props); - - // Check the declared version - List childAssocs = nodeService.getChildAssocs(unfiledContainer); - assertEquals(1, childAssocs.size()); - - // Declare document as record - recordService.createRecord(filePlan, document); - - // Check the declared versions - childAssocs = nodeService.getChildAssocs(unfiledContainer); - assertEquals(2, childAssocs.size()); - - // Check that the document is a file plan component - assertTrue(nodeService.hasAspect(document, ASPECT_FILE_PLAN_COMPONENT)); - - // Get the final version - NodeRef finalVersion = null; - for (ChildAssociationRef childAssociationRef : nodeService.getChildAssocs(unfiledContainer)) - { - NodeRef childRef = childAssociationRef.getChildRef(); - String label = (String) nodeService.getProperty(document, RecordableVersionModel.PROP_VERSION_LABEL); - - if (label.equals(I18NUtil.getMessage(FINAL_VERSION))) - { - finalVersion = childRef; - break; - } - } - - // The final version should be the declared record - assertEquals(document, finalVersion); - - // Check the relationship - Set relationships = relationshipService.getRelationshipsFrom(document); - assertEquals(1, relationships.size()); - Relationship relationship = relationships.iterator().next(); - assertEquals(CUSTOM_REF_VERSIONS.getLocalName(), relationship.getUniqueName()); - } - - public void when() - { - // Reject record - recordService.rejectRecord(document, generate()); - } - - public void then() - { - // Check the relationship - Set relationships = relationshipService.getRelationshipsFrom(document); - assertEquals(0, relationships.size()); - } - }); - } } diff --git a/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/record/ViewRecordTest.java b/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/record/ViewRecordTest.java deleted file mode 100644 index 116e618982..0000000000 --- a/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/record/ViewRecordTest.java +++ /dev/null @@ -1,103 +0,0 @@ -/* - * Copyright (C) 2005-2014 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - */ -package org.alfresco.module.org_alfresco_module_rm.test.integration.record; - -import java.util.HashSet; -import java.util.Set; - -import org.alfresco.module.org_alfresco_module_rm.capability.Capability; -import org.alfresco.module.org_alfresco_module_rm.capability.RMPermissionModel; -import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase; -import org.alfresco.repo.security.authentication.AuthenticationUtil; -import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.util.GUID; - -/** - * View record tests. - * - * @author Ana Bozianu - * @since 2.3 - */ -public class ViewRecordTest extends BaseRMTestCase -{ - /** - * Given a user with read permission on a record and without read permission on the parent folder check if the user can check if the record is filed - * - * @see https://issues.alfresco.com/jira/browse/RM-1738 - */ - public void testReadIsFiledPropertyWithoutReadPermissionOnParentFolder() throws Exception - { - doBehaviourDrivenTest(new BehaviourDrivenTest() - { - /** test data */ - String roleName = GUID.generate(); - String user = GUID.generate(); - NodeRef rc; - NodeRef recordFolder; - NodeRef record; - boolean recordIsFiled = false; - - public void given() - { - // create role - Set capabilities = new HashSet(2); - capabilities.add(capabilityService.getCapability("ViewRecords")); - filePlanRoleService.createRole(filePlan, roleName, roleName, capabilities); - - // create user and assign to role - createPerson(user, true); - filePlanRoleService.assignRoleToAuthority(filePlan, roleName, user); - - // create file plan structure - rc = filePlanService.createRecordCategory(filePlan, GUID.generate()); - NodeRef rsc = filePlanService.createRecordCategory(rc, GUID.generate()); - recordFolder = recordFolderService.createRecordFolder(rsc, GUID.generate()); - record = recordService.createRecordFromContent(recordFolder, GUID.generate(), TYPE_CONTENT, null, null); - } - - public void when() - { - // give read and file permissions on folder and remove permission from parent - filePlanPermissionService.setPermission(rc, user, RMPermissionModel.READ_RECORDS); - permissionService.setInheritParentPermissions(recordFolder, false); - filePlanPermissionService.setPermission(record, user, RMPermissionModel.READ_RECORDS); - - //check if the user can read the isFiled property - AuthenticationUtil.runAs(new RunAsWork() - { - public Void doWork() throws Exception - { - recordIsFiled = recordService.isFiled(record); - - return null; - } - }, user); - } - - public void then() - { - //check if the property is evaluated correctly - assertTrue(recordIsFiled); - } - - }); - } - -} diff --git a/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/recordfolder/MoveRecordFolderTest.java b/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/recordfolder/MoveRecordFolderTest.java index 2cac3c292d..e0f383a5bf 100644 --- a/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/recordfolder/MoveRecordFolderTest.java +++ b/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/recordfolder/MoveRecordFolderTest.java @@ -59,7 +59,7 @@ public class MoveRecordFolderTest extends BaseRMTestCase */ public void testMoveRecordFolderBeforeCutOffFolderLevelDisposition() throws Exception { - doBehaviourDrivenTest(new BehaviourDrivenTest(null, false) + doBehaviourDrivenTest(new BehaviourDrivenTest(false) { NodeRef recordFolder; NodeRef destinationRecordCategory; @@ -141,7 +141,7 @@ public class MoveRecordFolderTest extends BaseRMTestCase */ public void testMoveRecordFolderBeforeCutOffIntoAFolderWithNoDisposition() throws Exception { - doBehaviourDrivenTest(new BehaviourDrivenTest(null, false) + doBehaviourDrivenTest(new BehaviourDrivenTest(false) { NodeRef recordFolder; NodeRef destinationRecordCategory; @@ -217,7 +217,7 @@ public class MoveRecordFolderTest extends BaseRMTestCase */ public void testMoveRecordFolderWithRecordsBeforeCutOffRecordLevelDisposition() throws Exception { - doBehaviourDrivenTest(new BehaviourDrivenTest(null, false) + doBehaviourDrivenTest(new BehaviourDrivenTest(false) { NodeRef record; NodeRef recordFolder; diff --git a/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/relationship/CreateRelationshipTest.java b/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/relationship/CreateRelationshipTest.java deleted file mode 100644 index ffa21c8785..0000000000 --- a/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/relationship/CreateRelationshipTest.java +++ /dev/null @@ -1,210 +0,0 @@ -/* - * Copyright (C) 2005-2014 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - */ - -package org.alfresco.module.org_alfresco_module_rm.test.integration.relationship; - -import java.util.HashSet; -import java.util.Set; - -import org.alfresco.module.org_alfresco_module_rm.capability.Capability; -import org.alfresco.module.org_alfresco_module_rm.capability.RMPermissionModel; -import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase; -import org.alfresco.repo.security.authentication.AuthenticationUtil; -import org.alfresco.repo.security.permissions.AccessDeniedException; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.util.GUID; - -/** - * Create relationship integration test. - * - * @author Roy Wetherall - * @since 2.3 - */ -public class CreateRelationshipTest extends BaseRMTestCase -{ - public void testReadOnlyPermissionOnSource() throws Exception - { - doBehaviourDrivenTest(new BehaviourDrivenTest(AccessDeniedException.class) - { - /** test data */ - private String roleName = GUID.generate(); - private String user = GUID.generate(); - private NodeRef sourceRecordCategory; - private NodeRef targetRecordCategory; - private NodeRef sourceRecordFolder; - private NodeRef targetRecordFolder; - private NodeRef sourceRecord; - private NodeRef targetRecord; - - public void given() throws Exception - { - // test entities - sourceRecordCategory = filePlanService.createRecordCategory(filePlan, GUID.generate()); - sourceRecordFolder = recordFolderService.createRecordFolder(sourceRecordCategory, GUID.generate()); - sourceRecord = utils.createRecord(sourceRecordFolder, GUID.generate()); - targetRecordCategory = filePlanService.createRecordCategory(filePlan, GUID.generate()); - targetRecordFolder = recordFolderService.createRecordFolder(targetRecordCategory, GUID.generate()); - targetRecord = utils.createRecord(targetRecordFolder, GUID.generate()); - - // create role - Set capabilities = new HashSet(2); - capabilities.add(capabilityService.getCapability("ViewRecords")); - capabilities.add(capabilityService.getCapability("ChangeOrDeleteReferences")); - filePlanRoleService.createRole(filePlan, roleName, roleName, capabilities); - - // create user and assign to role - createPerson(user, true); - filePlanRoleService.assignRoleToAuthority(filePlan, roleName, user); - } - - public void when() - { - // assign permissions - filePlanPermissionService.setPermission(sourceRecord, user, RMPermissionModel.READ_RECORDS); - filePlanPermissionService.setPermission(targetRecord, user, RMPermissionModel.FILING); - - AuthenticationUtil.runAs(new AuthenticationUtil.RunAsWork() - { - public Void doWork() throws Exception - { - relationshipService.addRelationship("crossreference", sourceRecord, targetRecord); - return null; - } - }, user); - } - }); - } - - public void testReadOnlyPermissionOnTarget() throws Exception - { - doBehaviourDrivenTest(new BehaviourDrivenTest(AccessDeniedException.class) - { - /** test data */ - private String roleName = GUID.generate(); - private String user = GUID.generate(); - private NodeRef sourceRecordCategory; - private NodeRef targetRecordCategory; - private NodeRef sourceRecordFolder; - private NodeRef targetRecordFolder; - private NodeRef sourceRecord; - private NodeRef targetRecord; - - public void given() throws Exception - { - // test entities - sourceRecordCategory = filePlanService.createRecordCategory(filePlan, GUID.generate()); - sourceRecordFolder = recordFolderService.createRecordFolder(sourceRecordCategory, GUID.generate()); - sourceRecord = utils.createRecord(sourceRecordFolder, GUID.generate()); - targetRecordCategory = filePlanService.createRecordCategory(filePlan, GUID.generate()); - targetRecordFolder = recordFolderService.createRecordFolder(targetRecordCategory, GUID.generate()); - targetRecord = utils.createRecord(targetRecordFolder, GUID.generate()); - - // create role - Set capabilities = new HashSet(2); - capabilities.add(capabilityService.getCapability("ViewRecords")); - capabilities.add(capabilityService.getCapability("ChangeOrDeleteReferences")); - filePlanRoleService.createRole(filePlan, roleName, roleName, capabilities); - - // create user and assign to role - createPerson(user, true); - filePlanRoleService.assignRoleToAuthority(filePlan, roleName, user); - - } - - public void when() - { - // assign permissions - filePlanPermissionService.setPermission(sourceRecord, user, RMPermissionModel.FILING); - filePlanPermissionService.setPermission(targetRecord, user, RMPermissionModel.READ_RECORDS); - - AuthenticationUtil.runAs(new AuthenticationUtil.RunAsWork() - { - public Void doWork() throws Exception - { - relationshipService.addRelationship("crossreference", sourceRecord, targetRecord); - return null; - } - }, user); - } - }); - } - - public void testFillingPermissionOnSourceAndTarget() throws Exception - { - doBehaviourDrivenTest(new BehaviourDrivenTest() - { - /** test data */ - private String roleName = GUID.generate(); - private String user = GUID.generate(); - private NodeRef sourceRecordCategory; - private NodeRef targetRecordCategory; - private NodeRef sourceRecordFolder; - private NodeRef targetRecordFolder; - private NodeRef sourceRecord; - private NodeRef targetRecord; - - public void given() throws Exception - { - // test entities - sourceRecordCategory = filePlanService.createRecordCategory(filePlan, GUID.generate()); - sourceRecordFolder = recordFolderService.createRecordFolder(sourceRecordCategory, GUID.generate()); - sourceRecord = utils.createRecord(sourceRecordFolder, GUID.generate()); - targetRecordCategory = filePlanService.createRecordCategory(filePlan, GUID.generate()); - targetRecordFolder = recordFolderService.createRecordFolder(targetRecordCategory, GUID.generate()); - targetRecord = utils.createRecord(targetRecordFolder, GUID.generate()); - - // create role - Set capabilities = new HashSet(2); - capabilities.add(capabilityService.getCapability("ViewRecords")); - capabilities.add(capabilityService.getCapability("ChangeOrDeleteReferences")); - filePlanRoleService.createRole(filePlan, roleName, roleName, capabilities); - - // create user and assign to role - createPerson(user, true); - filePlanRoleService.assignRoleToAuthority(filePlan, roleName, user); - } - - public void when() - { - // assign permissions - filePlanPermissionService.setPermission(sourceRecordCategory, user, RMPermissionModel.FILING); - filePlanPermissionService.setPermission(targetRecordCategory, user, RMPermissionModel.FILING); - - AuthenticationUtil.runAs(new AuthenticationUtil.RunAsWork() - { - public Void doWork() throws Exception - { - relationshipService.addRelationship("crossreference", sourceRecord, targetRecord); - return null; - } - }, user); - } - - @Override - public void then() throws Exception - { - // assert that the relationship exists - assertEquals(1, relationshipService.getRelationshipsFrom(sourceRecord).size()); - assertEquals(0, relationshipService.getRelationshipsTo(sourceRecord).size()); - assertEquals(0, relationshipService.getRelationshipsFrom(targetRecord).size()); - assertEquals(1, relationshipService.getRelationshipsTo(targetRecord).size()); - } - }); - } -} diff --git a/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/relationship/DeleteRelationshipTest.java b/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/relationship/DeleteRelationshipTest.java deleted file mode 100644 index 116541b597..0000000000 --- a/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/relationship/DeleteRelationshipTest.java +++ /dev/null @@ -1,260 +0,0 @@ -/* - * Copyright (C) 2005-2014 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - */ - -package org.alfresco.module.org_alfresco_module_rm.test.integration.relationship; - -import java.util.HashSet; -import java.util.Set; - -import org.alfresco.module.org_alfresco_module_rm.capability.Capability; -import org.alfresco.module.org_alfresco_module_rm.capability.RMPermissionModel; -import org.alfresco.module.org_alfresco_module_rm.relationship.Relationship; -import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase; -import org.alfresco.repo.security.authentication.AuthenticationUtil; -import org.alfresco.repo.security.permissions.AccessDeniedException; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.util.GUID; - -/** - * Delete relationship test. - * - * @author Ana Bozianu - * @since 2.3 - */ -public class DeleteRelationshipTest extends BaseRMTestCase -{ - public void testDeleteRelationship() throws Exception - { - doBehaviourDrivenTest(new BehaviourDrivenTest() - { - /** test data */ - NodeRef sourceNode; - NodeRef targetNode; - String associationName = CUSTOM_REF_OBSOLETES.getLocalName(); - - public void given() - { - - // create the source record - sourceNode = utils.createRecord(rmFolder, GUID.generate()); - - //create the target record - targetNode = utils.createRecord(rmFolder, GUID.generate()); - - //create relationship - relationshipService.addRelationship(associationName, sourceNode, targetNode); - } - - public void when() - { - //delete relationship - relationshipService.removeRelationship(associationName, sourceNode, targetNode); - } - - public void then() - { - //check if relationship is deleted - Set relationships = relationshipService.getRelationshipsFrom(sourceNode); - for(Relationship r : relationships) - { - assertFalse(r.getTarget().equals(targetNode) && r.getUniqueName().equals(associationName)); - } - } - }); - } - - public void testReadOnlyPermissionOnSource() throws Exception - { - doBehaviourDrivenTest(new BehaviourDrivenTest(AccessDeniedException.class) - { - /** test data */ - private String roleName = GUID.generate(); - private String user = GUID.generate(); - private NodeRef sourceRecordCategory; - private NodeRef targetRecordCategory; - private NodeRef sourceRecordFolder; - private NodeRef targetRecordFolder; - private NodeRef sourceRecord; - private NodeRef targetRecord; - - public void given() throws Exception - { - // test entities - sourceRecordCategory = filePlanService.createRecordCategory(filePlan, GUID.generate()); - sourceRecordFolder = recordFolderService.createRecordFolder(sourceRecordCategory, GUID.generate()); - sourceRecord = utils.createRecord(sourceRecordFolder, GUID.generate()); - targetRecordCategory = filePlanService.createRecordCategory(filePlan, GUID.generate()); - targetRecordFolder = recordFolderService.createRecordFolder(targetRecordCategory, GUID.generate()); - targetRecord = utils.createRecord(targetRecordFolder, GUID.generate()); - - // create role - Set capabilities = new HashSet(2); - capabilities.add(capabilityService.getCapability("ViewRecords")); - capabilities.add(capabilityService.getCapability("ChangeOrDeleteReferences")); - filePlanRoleService.createRole(filePlan, roleName, roleName, capabilities); - - // create user and assign to role - createPerson(user, true); - filePlanRoleService.assignRoleToAuthority(filePlan, roleName, user); - - // add relationship - relationshipService.addRelationship("crossreference", sourceRecord, targetRecord); - } - - public void when() - { - // assign permissions - filePlanPermissionService.setPermission(sourceRecord, user, RMPermissionModel.READ_RECORDS); - filePlanPermissionService.setPermission(targetRecord, user, RMPermissionModel.FILING); - - AuthenticationUtil.runAs(new AuthenticationUtil.RunAsWork() - { - public Void doWork() throws Exception - { - relationshipService.removeRelationship("crossreference", sourceRecord, targetRecord); - return null; - } - }, user); - } - }); - } - - public void testReadOnlyPermissionOnTarget() throws Exception - { - doBehaviourDrivenTest(new BehaviourDrivenTest(AccessDeniedException.class) - { - /** test data */ - private String roleName = GUID.generate(); - private String user = GUID.generate(); - private NodeRef sourceRecordCategory; - private NodeRef targetRecordCategory; - private NodeRef sourceRecordFolder; - private NodeRef targetRecordFolder; - private NodeRef sourceRecord; - private NodeRef targetRecord; - - public void given() throws Exception - { - // test entities - sourceRecordCategory = filePlanService.createRecordCategory(filePlan, GUID.generate()); - sourceRecordFolder = recordFolderService.createRecordFolder(sourceRecordCategory, GUID.generate()); - sourceRecord = utils.createRecord(sourceRecordFolder, GUID.generate()); - targetRecordCategory = filePlanService.createRecordCategory(filePlan, GUID.generate()); - targetRecordFolder = recordFolderService.createRecordFolder(targetRecordCategory, GUID.generate()); - targetRecord = utils.createRecord(targetRecordFolder, GUID.generate()); - - // create role - Set capabilities = new HashSet(2); - capabilities.add(capabilityService.getCapability("ViewRecords")); - capabilities.add(capabilityService.getCapability("ChangeOrDeleteReferences")); - filePlanRoleService.createRole(filePlan, roleName, roleName, capabilities); - - // create user and assign to role - createPerson(user, true); - filePlanRoleService.assignRoleToAuthority(filePlan, roleName, user); - - // create relationship - relationshipService.addRelationship("crossreference", sourceRecord, targetRecord); - } - - public void when() - { - // assign permissions - filePlanPermissionService.setPermission(sourceRecord, user, RMPermissionModel.FILING); - filePlanPermissionService.setPermission(targetRecord, user, RMPermissionModel.READ_RECORDS); - - AuthenticationUtil.runAs(new AuthenticationUtil.RunAsWork() - { - public Void doWork() throws Exception - { - relationshipService.removeRelationship("crossreference", sourceRecord, targetRecord); - return null; - } - }, user); - } - }); - } - - public void testFillingPermissionOnSourceAndTarget() throws Exception - { - doBehaviourDrivenTest(new BehaviourDrivenTest() - { - /** test data */ - private String roleName = GUID.generate(); - private String user = GUID.generate(); - private NodeRef sourceRecordCategory; - private NodeRef targetRecordCategory; - private NodeRef sourceRecordFolder; - private NodeRef targetRecordFolder; - private NodeRef sourceRecord; - private NodeRef targetRecord; - - public void given() throws Exception - { - // test entities - sourceRecordCategory = filePlanService.createRecordCategory(filePlan, GUID.generate()); - sourceRecordFolder = recordFolderService.createRecordFolder(sourceRecordCategory, GUID.generate()); - sourceRecord = utils.createRecord(sourceRecordFolder, GUID.generate()); - targetRecordCategory = filePlanService.createRecordCategory(filePlan, GUID.generate()); - targetRecordFolder = recordFolderService.createRecordFolder(targetRecordCategory, GUID.generate()); - targetRecord = utils.createRecord(targetRecordFolder, GUID.generate()); - - // create role - Set capabilities = new HashSet(2); - capabilities.add(capabilityService.getCapability("ViewRecords")); - capabilities.add(capabilityService.getCapability("ChangeOrDeleteReferences")); - filePlanRoleService.createRole(filePlan, roleName, roleName, capabilities); - - // create user and assign to role - createPerson(user, true); - filePlanRoleService.assignRoleToAuthority(filePlan, roleName, user); - - // create relationship - relationshipService.addRelationship("crossreference", sourceRecord, targetRecord); - } - - public void when() - { - // assign permissions - filePlanPermissionService.setPermission(sourceRecordCategory, user, RMPermissionModel.FILING); - filePlanPermissionService.setPermission(targetRecordCategory, user, RMPermissionModel.FILING); - - AuthenticationUtil.runAs(new AuthenticationUtil.RunAsWork() - { - public Void doWork() throws Exception - { - relationshipService.removeRelationship("crossreference", sourceRecord, targetRecord); - return null; - } - }, user); - } - - @Override - public void then() throws Exception - { - // assert that the relationship exists - assertEquals(0, relationshipService.getRelationshipsFrom(sourceRecord).size()); - assertEquals(0, relationshipService.getRelationshipsTo(sourceRecord).size()); - assertEquals(0, relationshipService.getRelationshipsFrom(targetRecord).size()); - assertEquals(0, relationshipService.getRelationshipsTo(targetRecord).size()); - } - }); - } - -} diff --git a/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/transfer/CreateTransferFolderAsNonAdminUser.java b/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/transfer/CreateTransferFolderAsNonAdminUser.java deleted file mode 100644 index 4409db99e8..0000000000 --- a/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/transfer/CreateTransferFolderAsNonAdminUser.java +++ /dev/null @@ -1,157 +0,0 @@ -/* - * Copyright (C) 2005-2015 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - */ -package org.alfresco.module.org_alfresco_module_rm.test.integration.transfer; - -import static org.alfresco.module.org_alfresco_module_rm.action.impl.CompleteEventAction.PARAM_EVENT_NAME; -import static org.alfresco.module.org_alfresco_module_rm.role.FilePlanRoleService.ROLE_RECORDS_MANAGER; -import static org.alfresco.module.org_alfresco_module_rm.test.util.CommonRMTestUtils.DEFAULT_DISPOSITION_AUTHORITY; -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.repo.security.authentication.AuthenticationUtil.getAdminUserName; -import static org.alfresco.repo.security.authentication.AuthenticationUtil.runAs; -import static org.alfresco.repo.site.SiteModel.SITE_CONSUMER; -import static org.alfresco.service.cmr.security.AccessStatus.ALLOWED; -import static org.alfresco.util.GUID.generate; - -import java.io.Serializable; -import java.util.HashMap; -import java.util.Map; - -import org.alfresco.module.org_alfresco_module_rm.action.impl.CompleteEventAction; -import org.alfresco.module.org_alfresco_module_rm.action.impl.CutOffAction; -import org.alfresco.module.org_alfresco_module_rm.action.impl.TransferAction; -import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase; -import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork; -import org.alfresco.service.cmr.repository.NodeRef; - -/** - * Test case which shows that the user who creates the transfer gets filing permissions granted. - * - * @author Tuna Aksoy - * @since 2.3 - */ -public class CreateTransferFolderAsNonAdminUser extends BaseRMTestCase -{ - // Test user - private String testUser = null; - - /** - * @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase#isUserTest() - */ - @Override - protected boolean isUserTest() - { - return true; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase#setupTestUsersImpl(org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - protected void setupTestUsersImpl(NodeRef filePlan) - { - super.setupTestUsersImpl(filePlan); - - // Create test user - testUser = generate(); - createPerson(testUser); - - // Join the RM site - siteService.setMembership(siteId, testUser, SITE_CONSUMER); - - // Add the test user to RM Records Manager role - filePlanRoleService.assignRoleToAuthority(filePlan, ROLE_RECORDS_MANAGER, testUser); - } - - public void testCreateTransferFolderAsNonAdminUser() - { - doBehaviourDrivenTest(new BehaviourDrivenTest(testUser) - { - // Records folder - private NodeRef recordsFolder = null; - - // Transfer folder - private NodeRef transferFolder = null; - - /** - * @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase.BehaviourDrivenTest#given() - */ - @Override - public void given() - { - runAs(new RunAsWork() - { - public Void doWork() - { - // Create category - NodeRef category = filePlanService.createRecordCategory(filePlan, generate()); - - // Give filing permissions for the test users on the category - filePlanPermissionService.setPermission(category, testUser, FILING); - - // Create disposition schedule - utils.createDispositionSchedule(category, DEFAULT_DISPOSITION_INSTRUCTIONS, DEFAULT_DISPOSITION_AUTHORITY, false, true, true); - - // Create folder - recordsFolder = recordFolderService.createRecordFolder(category, generate()); - - // Make eligible for cut off - Map params = new HashMap(1); - params.put(PARAM_EVENT_NAME, DEFAULT_EVENT_NAME); - rmActionService.executeRecordsManagementAction(recordsFolder, CompleteEventAction.NAME, params); - - // Cut off folder - rmActionService.executeRecordsManagementAction(recordsFolder, CutOffAction.NAME); - - return null; - } - }, getAdminUserName()); - - // FIXME: This step should be executed in "when()". - transferFolder = (NodeRef) rmActionService.executeRecordsManagementAction(recordsFolder, TransferAction.NAME).getValue(); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase.BehaviourDrivenTest#when() - */ - @Override - public void when() - { - // FIXME: If the transfer step is executed here the test fails?!? - //transferFolder = (NodeRef) rmActionService.executeRecordsManagementAction(recordsFolder, TransferAction.NAME).getValue(); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase.BehaviourDrivenTest#then() - */ - @Override - public void then() - { - // Check transfer folder - assertNotNull(transferFolder); - - // User should have read permissions on the transfers container - assertEquals(ALLOWED, permissionService.hasPermission(transfersContainer, READ_RECORDS)); - - // Check if the user has filing permissions on the transfer folder - assertEquals(ALLOWED, permissionService.hasPermission(transferFolder, FILING)); - } - }); - } -} diff --git a/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/transfer/FilingPermissionsOnTransferFolder.java b/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/transfer/FilingPermissionsOnTransferFolder.java deleted file mode 100644 index 7d4cb377c6..0000000000 --- a/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/transfer/FilingPermissionsOnTransferFolder.java +++ /dev/null @@ -1,191 +0,0 @@ -/* - * Copyright (C) 2005-2015 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - */ -package org.alfresco.module.org_alfresco_module_rm.test.integration.transfer; - -import static org.alfresco.module.org_alfresco_module_rm.action.impl.CompleteEventAction.PARAM_EVENT_NAME; -import static org.alfresco.module.org_alfresco_module_rm.role.FilePlanRoleService.ROLE_RECORDS_MANAGER; -import static org.alfresco.module.org_alfresco_module_rm.test.util.CommonRMTestUtils.DEFAULT_DISPOSITION_AUTHORITY; -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.repo.security.authentication.AuthenticationUtil.getAdminUserName; -import static org.alfresco.repo.security.authentication.AuthenticationUtil.runAs; -import static org.alfresco.repo.site.SiteModel.SITE_CONSUMER; -import static org.alfresco.service.cmr.security.AccessStatus.ALLOWED; -import static org.alfresco.util.GUID.generate; - -import java.io.Serializable; -import java.util.HashMap; -import java.util.Map; - -import org.alfresco.module.org_alfresco_module_rm.action.impl.CompleteEventAction; -import org.alfresco.module.org_alfresco_module_rm.action.impl.CutOffAction; -import org.alfresco.module.org_alfresco_module_rm.action.impl.TransferAction; -import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase; -import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork; -import org.alfresco.service.cmr.repository.NodeRef; - -/** - * Test case which shows that the user who did not create a transfer folder will - * be able to see and action on it if he gets filing permission on the transfer folder. - * - * @author Tuna Aksoy - * @since 2.3 - */ -public class FilingPermissionsOnTransferFolder extends BaseRMTestCase -{ - // Test users - private String testUser1 = null; - private String testUser2 = null; - - /** - * @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase#isUserTest() - */ - @Override - protected boolean isUserTest() - { - return true; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase#setupTestUsersImpl(org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - protected void setupTestUsersImpl(NodeRef filePlan) - { - super.setupTestUsersImpl(filePlan); - - // Create test users - testUser1 = generate(); - createPerson(testUser1); - testUser2 = generate(); - createPerson(testUser2); - - // Join the RM site - siteService.setMembership(siteId, testUser1, SITE_CONSUMER); - siteService.setMembership(siteId, testUser2, SITE_CONSUMER); - - // Add the test users to RM Records Manager role - filePlanRoleService.assignRoleToAuthority(filePlan, ROLE_RECORDS_MANAGER, testUser1); - filePlanRoleService.assignRoleToAuthority(filePlan, ROLE_RECORDS_MANAGER, testUser2); - } - - public void testFilingPermissionsOnTransferFolder() - { - doBehaviourDrivenTest(new BehaviourDrivenTest(testUser1) - { - // Records folder - private NodeRef recordsFolder = null; - - // Transfer folder - private NodeRef transferFolder = null; - - /** - * @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase.BehaviourDrivenTest#given() - */ - @Override - public void given() - { - runAs(new RunAsWork() - { - public Void doWork() - { - // Create category - NodeRef category = filePlanService.createRecordCategory(filePlan, generate()); - - // Give filing permissions for the test users on the category - filePlanPermissionService.setPermission(category, testUser1, FILING); - filePlanPermissionService.setPermission(category, testUser2, FILING); - - // Create disposition schedule - utils.createDispositionSchedule(category, DEFAULT_DISPOSITION_INSTRUCTIONS, DEFAULT_DISPOSITION_AUTHORITY, false, true, true); - - // Create folder - recordsFolder = recordFolderService.createRecordFolder(category, generate()); - - // Make eligible for cut off - Map params = new HashMap(1); - params.put(PARAM_EVENT_NAME, DEFAULT_EVENT_NAME); - rmActionService.executeRecordsManagementAction(recordsFolder, CompleteEventAction.NAME, params); - - // Cut off folder - rmActionService.executeRecordsManagementAction(recordsFolder, CutOffAction.NAME); - - return null; - } - }, getAdminUserName()); - - // FIXME: This step should be executed in "when()". - transferFolder = (NodeRef) rmActionService.executeRecordsManagementAction(recordsFolder, TransferAction.NAME).getValue(); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase.BehaviourDrivenTest#when() - */ - @Override - public void when() - { - // FIXME: If the transfer step is executed here the test fails. - //transferFolder = (NodeRef) rmActionService.executeRecordsManagementAction(recordsFolder, TransferAction.NAME).getValue(); - - // Give testUser2 filing permissions on transfer folder - filePlanPermissionService.setPermission(transferFolder, testUser2, FILING); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase.BehaviourDrivenTest#then() - */ - @Override - public void then() - { - // Check transfer folder - assertNotNull(transferFolder); - - // testUser1 should have read permissions on the transfers container - assertEquals(ALLOWED, permissionService.hasPermission(transfersContainer, READ_RECORDS)); - - // Check if testUser1 has filing permissions on the transfer folder - assertEquals(ALLOWED, permissionService.hasPermission(transferFolder, FILING)); - - runAs(new RunAsWork() - { - public Void doWork() - { - // Check transfer folder - assertNotNull(transferFolder); - - // testUser2 should have read permissions on the transfers container - assertEquals(ALLOWED, permissionService.hasPermission(transfersContainer, READ_RECORDS)); - - // Check if testUser2 has read permissions on the transfer folder - assertEquals(ALLOWED, permissionService.hasPermission(transferFolder, READ_RECORDS)); - - // Check if testUser2 has filing permissions on the transfer folder - assertEquals(ALLOWED, permissionService.hasPermission(transferFolder, FILING)); - - // FIXME: Should be able to execute the action. Failing intermittently. - // Execute transfer complete action as testUser2 who has filing permissions on the transfer folder - // rmActionService.executeRecordsManagementAction(transferFolder, TransferCompleteAction.NAME); - - return null; - } - }, testUser2); - } - }); - } -} diff --git a/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/transfer/NoPermissionsOnTransferFolder.java b/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/transfer/NoPermissionsOnTransferFolder.java deleted file mode 100644 index 4ac4cf4fba..0000000000 --- a/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/transfer/NoPermissionsOnTransferFolder.java +++ /dev/null @@ -1,181 +0,0 @@ -/* - * Copyright (C) 2005-2015 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - */ -package org.alfresco.module.org_alfresco_module_rm.test.integration.transfer; - -import static org.alfresco.module.org_alfresco_module_rm.action.impl.CompleteEventAction.PARAM_EVENT_NAME; -import static org.alfresco.module.org_alfresco_module_rm.role.FilePlanRoleService.ROLE_RECORDS_MANAGER; -import static org.alfresco.module.org_alfresco_module_rm.test.util.CommonRMTestUtils.DEFAULT_DISPOSITION_AUTHORITY; -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.repo.security.authentication.AuthenticationUtil.getAdminUserName; -import static org.alfresco.repo.security.authentication.AuthenticationUtil.runAs; -import static org.alfresco.repo.site.SiteModel.SITE_CONSUMER; -import static org.alfresco.service.cmr.security.AccessStatus.ALLOWED; -import static org.alfresco.service.cmr.security.AccessStatus.DENIED; -import static org.alfresco.util.GUID.generate; - -import java.io.Serializable; -import java.util.HashMap; -import java.util.Map; - -import org.alfresco.module.org_alfresco_module_rm.action.impl.CompleteEventAction; -import org.alfresco.module.org_alfresco_module_rm.action.impl.CutOffAction; -import org.alfresco.module.org_alfresco_module_rm.action.impl.TransferAction; -import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase; -import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork; -import org.alfresco.service.cmr.repository.NodeRef; - -/** - * Test case which shows that the user who did not create a transfer folder will not be able to see it. - * - * @author Tuna Aksoy - * @since 2.3 - */ -public class NoPermissionsOnTransferFolder extends BaseRMTestCase -{ - // Test users - private String testUser1 = null; - private String testUser2 = null; - - /** - * @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase#isUserTest() - */ - @Override - protected boolean isUserTest() - { - return true; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase#setupTestUsersImpl(org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - protected void setupTestUsersImpl(NodeRef filePlan) - { - super.setupTestUsersImpl(filePlan); - - // Create test users - testUser1 = generate(); - createPerson(testUser1); - testUser2 = generate(); - createPerson(testUser2); - - // Join the RM site - siteService.setMembership(siteId, testUser1, SITE_CONSUMER); - siteService.setMembership(siteId, testUser2, SITE_CONSUMER); - - // Add the test users to RM Records Manager role - filePlanRoleService.assignRoleToAuthority(filePlan, ROLE_RECORDS_MANAGER, testUser1); - filePlanRoleService.assignRoleToAuthority(filePlan, ROLE_RECORDS_MANAGER, testUser2); - } - - public void testNoPermissionsOnTransferFolder() - { - doBehaviourDrivenTest(new BehaviourDrivenTest(testUser1) - { - // Records folder - private NodeRef recordsFolder = null; - - // Transfer folder - private NodeRef transferFolder = null; - - /** - * @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase.BehaviourDrivenTest#given() - */ - @Override - public void given() - { - runAs(new RunAsWork() - { - public Void doWork() - { - // Create category - NodeRef category = filePlanService.createRecordCategory(filePlan, generate()); - - // Give filing permissions for the test users on the category - filePlanPermissionService.setPermission(category, testUser1, FILING); - filePlanPermissionService.setPermission(category, testUser2, FILING); - - // Create disposition schedule - utils.createDispositionSchedule(category, DEFAULT_DISPOSITION_INSTRUCTIONS, DEFAULT_DISPOSITION_AUTHORITY, false, true, true); - - // Create folder - recordsFolder = recordFolderService.createRecordFolder(category, generate()); - - // Make eligible for cut off - Map params = new HashMap(1); - params.put(PARAM_EVENT_NAME, DEFAULT_EVENT_NAME); - rmActionService.executeRecordsManagementAction(recordsFolder, CompleteEventAction.NAME, params); - - // Cut off folder - rmActionService.executeRecordsManagementAction(recordsFolder, CutOffAction.NAME); - - return null; - } - }, getAdminUserName()); - - // FIXME: This step should be executed in "when()". - transferFolder = (NodeRef) rmActionService.executeRecordsManagementAction(recordsFolder, TransferAction.NAME).getValue(); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase.BehaviourDrivenTest#when() - */ - @Override - public void when() - { - // FIXME: If the transfer step is executed here the test fails. - //transferFolder = (NodeRef) rmActionService.executeRecordsManagementAction(recordsFolder, TransferAction.NAME).getValue(); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase.BehaviourDrivenTest#then() - */ - @Override - public void then() - { - // Check transfer folder - assertNotNull(transferFolder); - - // testUser1 should have read permissions on the transfers container - assertEquals(ALLOWED, permissionService.hasPermission(transfersContainer, READ_RECORDS)); - - // Check if testUser1 has filing permissions on the transfer folder - assertEquals(ALLOWED, permissionService.hasPermission(transferFolder, FILING)); - - runAs(new RunAsWork() - { - public Void doWork() - { - // Check transfer folder - assertNotNull(transferFolder); - - // testUser2 should have read permissions on the transfers container - assertEquals(ALLOWED, permissionService.hasPermission(transfersContainer, READ_RECORDS)); - - // Check if testUser2 has read permissions on the transfer folder - assertEquals(DENIED, permissionService.hasPermission(transferFolder, READ_RECORDS)); - - return null; - } - }, testUser2); - } - }); - } -} diff --git a/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/transfer/ReadPermissionsOnTransferFolder.java b/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/transfer/ReadPermissionsOnTransferFolder.java deleted file mode 100644 index 2ad2e58d49..0000000000 --- a/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/transfer/ReadPermissionsOnTransferFolder.java +++ /dev/null @@ -1,201 +0,0 @@ -/* - * Copyright (C) 2005-2015 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - */ -package org.alfresco.module.org_alfresco_module_rm.test.integration.transfer; - -import static org.alfresco.module.org_alfresco_module_rm.action.impl.CompleteEventAction.PARAM_EVENT_NAME; -import static org.alfresco.module.org_alfresco_module_rm.role.FilePlanRoleService.ROLE_RECORDS_MANAGER; -import static org.alfresco.module.org_alfresco_module_rm.test.util.CommonRMTestUtils.DEFAULT_DISPOSITION_AUTHORITY; -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.repo.security.authentication.AuthenticationUtil.getAdminUserName; -import static org.alfresco.repo.security.authentication.AuthenticationUtil.runAs; -import static org.alfresco.repo.site.SiteModel.SITE_CONSUMER; -import static org.alfresco.service.cmr.security.AccessStatus.ALLOWED; -import static org.alfresco.service.cmr.security.AccessStatus.DENIED; -import static org.alfresco.util.GUID.generate; - -import java.io.Serializable; -import java.util.HashMap; -import java.util.Map; - -import org.alfresco.module.org_alfresco_module_rm.action.impl.CompleteEventAction; -import org.alfresco.module.org_alfresco_module_rm.action.impl.CutOffAction; -import org.alfresco.module.org_alfresco_module_rm.action.impl.TransferAction; -import org.alfresco.module.org_alfresco_module_rm.action.impl.TransferCompleteAction; -import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase; -import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork; -import org.alfresco.repo.security.permissions.AccessDeniedException; -import org.alfresco.service.cmr.repository.NodeRef; - -/** - * Test case which shows that the user who did not create a transfer folder will - * be able to see the transfer folder if he gets read permissions, but will not - * be able to action on it. - * - * @author Tuna Aksoy - * @since 2.3 - */ -public class ReadPermissionsOnTransferFolder extends BaseRMTestCase -{ - // Test users - private String testUser1 = null; - private String testUser2 = null; - - /** - * @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase#isUserTest() - */ - @Override - protected boolean isUserTest() - { - return true; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase#setupTestUsersImpl(org.alfresco.service.cmr.repository.NodeRef) - */ - @Override - protected void setupTestUsersImpl(NodeRef filePlan) - { - super.setupTestUsersImpl(filePlan); - - // Create test users - testUser1 = generate(); - createPerson(testUser1); - testUser2 = generate(); - createPerson(testUser2); - - // Join the RM site - siteService.setMembership(siteId, testUser1, SITE_CONSUMER); - siteService.setMembership(siteId, testUser2, SITE_CONSUMER); - - // Add the users to RM Records Manager role - filePlanRoleService.assignRoleToAuthority(filePlan, ROLE_RECORDS_MANAGER, testUser1); - filePlanRoleService.assignRoleToAuthority(filePlan, ROLE_RECORDS_MANAGER, testUser2); - } - - public void testReadPermissionsOnTransferFolder() - { - doBehaviourDrivenTest(new BehaviourDrivenTest(testUser1) - { - // Records folder - private NodeRef recordsFolder = null; - - // Transfer folder - private NodeRef transferFolder = null; - - /** - * @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase.BehaviourDrivenTest#given() - */ - @Override - public void given() - { - runAs(new RunAsWork() - { - public Void doWork() - { - // Create category - NodeRef category = filePlanService.createRecordCategory(filePlan, generate()); - - // Give filing permissions for the test users on the category - filePlanPermissionService.setPermission(category, testUser1, FILING); - filePlanPermissionService.setPermission(category, testUser2, FILING); - - // Create disposition schedule - utils.createDispositionSchedule(category, DEFAULT_DISPOSITION_INSTRUCTIONS, DEFAULT_DISPOSITION_AUTHORITY, false, true, true); - - // Create folder - recordsFolder = recordFolderService.createRecordFolder(category, generate()); - - // Make eligible for cut off - Map params = new HashMap(1); - params.put(PARAM_EVENT_NAME, DEFAULT_EVENT_NAME); - rmActionService.executeRecordsManagementAction(recordsFolder, CompleteEventAction.NAME, params); - - // Cut off folder - rmActionService.executeRecordsManagementAction(recordsFolder, CutOffAction.NAME); - - return null; - } - }, getAdminUserName()); - - // FIXME: This step should be executed in "when()". - transferFolder = (NodeRef) rmActionService.executeRecordsManagementAction(recordsFolder, TransferAction.NAME).getValue(); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase.BehaviourDrivenTest#when() - */ - @Override - public void when() - { - // FIXME: If the transfer step is executed here the test fails. - //transferFolder = (NodeRef) rmActionService.executeRecordsManagementAction(recordsFolder, TransferAction.NAME).getValue(); - - // Give testUser2 read permissions on transfer folder - filePlanPermissionService.setPermission(transferFolder, testUser2, READ_RECORDS); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase.BehaviourDrivenTest#then() - */ - @Override - public void then() - { - // Check transfer folder - assertNotNull(transferFolder); - - // testUser1 should have read permissions on the transfers container - assertEquals(ALLOWED, permissionService.hasPermission(transfersContainer, READ_RECORDS)); - - // Check if testUser1 has filing permissions on the transfer folder - assertEquals(ALLOWED, permissionService.hasPermission(transferFolder, FILING)); - - runAs(new RunAsWork() - { - public Void doWork() - { - // Check transfer folder - assertNotNull(transferFolder); - - // testUser2 should have read permissions on the transfers container - assertEquals(ALLOWED, permissionService.hasPermission(transfersContainer, READ_RECORDS)); - - // Check if testUser2 has read permissions on the transfer folder - assertEquals(ALLOWED, permissionService.hasPermission(transferFolder, READ_RECORDS)); - - // Check if testUser2 filing permissions on the transfer folder - assertEquals(DENIED, permissionService.hasPermission(transferFolder, FILING)); - - // Try to execute transfer complete action as testUser2 who has no filing permissions on the transfer folder - try - { - rmActionService.executeRecordsManagementAction(transferFolder, TransferCompleteAction.NAME); - } - catch (AccessDeniedException ade) - { - // Expected - } - - return null; - } - }, testUser2); - } - }); - } -} diff --git a/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/transfer/TransferTestSuite.java b/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/transfer/TransferTestSuite.java deleted file mode 100644 index ceb1a8dedb..0000000000 --- a/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/transfer/TransferTestSuite.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright (C) 2005-2015 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - */ -package org.alfresco.module.org_alfresco_module_rm.test.integration.transfer; - -import org.junit.runner.RunWith; -import org.junit.runners.Suite; -import org.junit.runners.Suite.SuiteClasses; - -/** - * Transfer test suite - * - * @author Tuna Aksoy - * @since 2.3 - */ -@RunWith(Suite.class) -@SuiteClasses( -{ - CreateTransferFolderAsNonAdminUser.class, - FilingPermissionsOnTransferFolder.class, - NoPermissionsOnTransferFolder.class, - ReadPermissionsOnTransferFolder.class -}) -public class TransferTestSuite -{ - -} diff --git a/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/version/AdHocRecordableVersionsTest.java b/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/version/AdHocRecordableVersionsTest.java deleted file mode 100644 index c7b1e08f4c..0000000000 --- a/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/version/AdHocRecordableVersionsTest.java +++ /dev/null @@ -1,190 +0,0 @@ -/* - * Copyright (C) 2005-2014 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - */ -package org.alfresco.module.org_alfresco_module_rm.test.integration.version; - -import java.io.Serializable; -import java.util.HashMap; -import java.util.Map; - -import org.alfresco.error.AlfrescoRuntimeException; -import org.alfresco.module.org_alfresco_module_rm.test.util.TestModel; -import org.alfresco.module.org_alfresco_module_rm.version.RecordableVersionServiceImpl; -import org.alfresco.repo.security.authentication.AuthenticationUtil; -import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork; -import org.alfresco.repo.version.VersionModel; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.version.Version; -import org.alfresco.service.cmr.version.VersionType; - -/** - * AdHoc Recordable Versions Integration Test - * - * @author Roy Wetherall - * @since 2.3 - */ -public class AdHocRecordableVersionsTest extends RecordableVersionsBaseTest -{ - /** - * Adhoc recorded version creation, with no policy defined as site collaborator - */ - public void testRecordAdHocVersionNoPolicy() - { - doBehaviourDrivenTest(new BehaviourDrivenTest(dmCollaborator) - { - private Map versionProperties; - - public void given() throws Exception - { - // setup version properties - versionProperties = new HashMap(4); - versionProperties.put(Version.PROP_DESCRIPTION, DESCRIPTION); - versionProperties.put(VersionModel.PROP_VERSION_TYPE, VersionType.MINOR); - versionProperties.put(RecordableVersionServiceImpl.KEY_RECORDABLE_VERSION, true); - versionProperties.put(RecordableVersionServiceImpl.KEY_FILE_PLAN, filePlan); - } - - public void when() - { - // create version - versionService.createVersion(dmDocument, versionProperties); - } - - public void then() - { - // check that the record has been recorded - checkRecordedVersion(dmDocument, DESCRIPTION, "0.1"); - } - }); - } - - /** - * Adhoc recordable version with recordable set as false - */ - public void testRecordableVersionFalseNoPolicy() - { - doBehaviourDrivenTest(new BehaviourDrivenTest(dmCollaborator) - { - private Map versionProperties; - - public void given() throws Exception - { - // setup version properties - versionProperties = new HashMap(4); - versionProperties.put(Version.PROP_DESCRIPTION, DESCRIPTION); - versionProperties.put(VersionModel.PROP_VERSION_TYPE, VersionType.MINOR); - versionProperties.put(RecordableVersionServiceImpl.KEY_RECORDABLE_VERSION, false); - versionProperties.put(RecordableVersionServiceImpl.KEY_FILE_PLAN, filePlan); - } - - public void when() - { - // create version - versionService.createVersion(dmDocument, versionProperties); - } - - public void then() - { - // check that the record has been recorded - checkNotRecordedAspect(dmDocument, DESCRIPTION, "0.1"); - } - }); - } - - /** - * Test no file plan specified (and no default available) - */ - public void testNoFilePlan() - { - doBehaviourDrivenTest(new BehaviourDrivenTest(AlfrescoRuntimeException.class, dmCollaborator) - { - private Map versionProperties; - - public void given() throws Exception - { - // setup version properties - versionProperties = new HashMap(4); - versionProperties.put(Version.PROP_DESCRIPTION, DESCRIPTION); - versionProperties.put(VersionModel.PROP_VERSION_TYPE, VersionType.MINOR); - versionProperties.put(RecordableVersionServiceImpl.KEY_RECORDABLE_VERSION, true); - } - - public void when() - { - // create version - versionService.createVersion(dmDocument, versionProperties); - } - - public void then() - { - // check that the record has been recorded - checkRecordedVersion(dmDocument, DESCRIPTION, "0.1"); - } - - }); - } - - /** - * Test recorded version with record metadata aspect (want to ensure additional non-rm URI properties and aspects - * don't find their way into the frozen state) - */ - public void testRecordedVersionWithRecordMetadataAspect() - { - doBehaviourDrivenTest(new BehaviourDrivenTest(dmCollaborator) - { - private Map versionProperties; - - public void given() throws Exception - { - // setup version properties - versionProperties = new HashMap(4); - versionProperties.put(Version.PROP_DESCRIPTION, DESCRIPTION); - versionProperties.put(VersionModel.PROP_VERSION_TYPE, VersionType.MINOR); - versionProperties.put(RecordableVersionServiceImpl.KEY_RECORDABLE_VERSION, true); - versionProperties.put(RecordableVersionServiceImpl.KEY_FILE_PLAN, filePlan); - } - - public void when() - { - // create version - final Version version = versionService.createVersion(dmDocument, versionProperties); - - AuthenticationUtil.runAs(new RunAsWork() - { - public Void doWork() throws Exception - { - // add custom meta-data to record - NodeRef record = (NodeRef)version.getVersionProperties().get(RecordableVersionServiceImpl.PROP_VERSION_RECORD); - assertNotNull(record); - recordService.addRecordType(record, TestModel.ASPECT_RECORD_METADATA); - nodeService.setProperty(record, TestModel.PROPERTY_RECORD_METADATA, "Peter Wetherall"); - - return null; - } - }, AuthenticationUtil.getAdminUserName()); - } - - public void then() - { - // check that the record has been recorded - checkRecordedVersion(dmDocument, DESCRIPTION, "0.1"); - } - }); - } - -} diff --git a/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/version/AutoRecordableVersionsTest.java b/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/version/AutoRecordableVersionsTest.java deleted file mode 100644 index a9e4d678a3..0000000000 --- a/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/version/AutoRecordableVersionsTest.java +++ /dev/null @@ -1,171 +0,0 @@ -/* - * Copyright (C) 2005-2014 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - */ -package org.alfresco.module.org_alfresco_module_rm.test.integration.version; - -import java.util.Set; - -import org.alfresco.model.ContentModel; -import org.alfresco.module.org_alfresco_module_rm.relationship.Relationship; -import org.alfresco.module.org_alfresco_module_rm.version.RecordableVersionModel; -import org.alfresco.module.org_alfresco_module_rm.version.RecordableVersionPolicy; -import org.alfresco.module.org_alfresco_module_rm.version.RecordableVersionServiceImpl; -import org.alfresco.service.cmr.repository.ContentWriter; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.version.Version; -import org.alfresco.util.PropertyMap; - -/** - * Auto Recordable Versions Integration Test - * - * @author Roy Wetherall - * @since 2.3 - */ -public class AutoRecordableVersionsTest extends RecordableVersionsBaseTest -{ - /** example content */ - public final static String MY_NEW_CONTENT = "this is some new content that I have changed to trigger auto version"; - - /** - * Given that all revisions will be recorded, - * When I update the content of a document, - * Then a recorded version will be created - */ - public void testAutoVersionRecordAllRevisions() - { - doBehaviourDrivenTest(new BehaviourDrivenTest(dmCollaborator) - { - public void given() throws Exception - { - // set the recordable version policy - PropertyMap recordableVersionProperties = new PropertyMap(1); - recordableVersionProperties.put(PROP_RECORDABLE_VERSION_POLICY, RecordableVersionPolicy.ALL); - recordableVersionProperties.put(PROP_FILE_PLAN, filePlan); - nodeService.addAspect(dmDocument, RecordableVersionModel.ASPECT_VERSIONABLE, recordableVersionProperties); - - // make the node versionable - PropertyMap versionableProperties = new PropertyMap(1); - versionableProperties.put(ContentModel.PROP_INITIAL_VERSION, false); - nodeService.addAspect(dmDocument, ContentModel.ASPECT_VERSIONABLE, versionableProperties); - } - - public void when() - { - // generate new version by updating content - ContentWriter writer = contentService.getWriter(dmDocument, ContentModel.PROP_CONTENT, true); - writer.putContent(MY_NEW_CONTENT); - } - - public void then() - { - // check that the record has been recorded - checkRecordedVersion(dmDocument, null, "0.1"); - } - }); - } - - /** - * Given that all revisions will be automatically recorded, - * When I update a document 3 times, - * Then all 3 created records will be related together using the "VersionedBy" relationship - */ - public void testVersionRecordsRelated() - { - doBehaviourDrivenTest(new BehaviourDrivenTest(dmCollaborator, false) - { - /** given **/ - public void given() throws Exception - { - doTestInTransaction(new VoidTest() - { - @Override - public void runImpl() throws Exception - { - // set the recordable version policy - PropertyMap recordableVersionProperties = new PropertyMap(1); - recordableVersionProperties.put(PROP_RECORDABLE_VERSION_POLICY, RecordableVersionPolicy.ALL); - recordableVersionProperties.put(PROP_FILE_PLAN, filePlan); - nodeService.addAspect(dmDocument, RecordableVersionModel.ASPECT_VERSIONABLE, recordableVersionProperties); - - // make the node versionable - PropertyMap versionableProperties = new PropertyMap(1); - versionableProperties.put(ContentModel.PROP_INITIAL_VERSION, false); - nodeService.addAspect(dmDocument, ContentModel.ASPECT_VERSIONABLE, versionableProperties); - } - }); - } - - /** when **/ - public void when() - { - // update the content 3 times - updateContent(); - updateContent(); - updateContent(); - } - - /** then */ - public void then() - { - doTestInTransaction(new VoidTest() - { - @Override - public void runImpl() throws Exception - { - // check that the record has been recorded - checkRecordedVersion(dmDocument, null, "0.3"); - - Version version = versionService.getCurrentVersion(dmDocument); - NodeRef record = (NodeRef)version.getVersionProperties().get(RecordableVersionServiceImpl.PROP_VERSION_RECORD); - - boolean foundPrevious = false; - Set relationships = relationshipService.getRelationshipsFrom(record); - assertNotNull(relationships); - assertEquals(1, relationships.size()); - for (Relationship relationship : relationships) - { - if (relationship.getUniqueName().equals(CUSTOM_REF_VERSIONS.getLocalName())) - { - NodeRef previousVersionRecord = relationship.getTarget(); - assertNotNull(previousVersionRecord); - foundPrevious = true; - } - } - assertTrue(foundPrevious); - } - }); - } - - /** - * Helper method to update content of dmDocument - */ - private void updateContent() - { - doTestInTransaction(new VoidTest() - { - @Override - public void runImpl() throws Exception - { - ContentWriter writer = contentService.getWriter(dmDocument, ContentModel.PROP_CONTENT, true); - writer.putContent(MY_NEW_CONTENT); - } - }); - } - }); - } -} diff --git a/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/version/DeclareAsRecordVersionTest.java b/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/version/DeclareAsRecordVersionTest.java deleted file mode 100755 index d6e33fb515..0000000000 --- a/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/version/DeclareAsRecordVersionTest.java +++ /dev/null @@ -1,150 +0,0 @@ -/* - * Copyright (C) 2005-2014 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - */ -package org.alfresco.module.org_alfresco_module_rm.test.integration.version; - -import java.io.Serializable; -import java.util.HashMap; -import java.util.Map; - -import org.alfresco.module.org_alfresco_module_rm.version.RecordableVersionService; -import org.alfresco.module.org_alfresco_module_rm.version.RecordableVersionServiceImpl; -import org.alfresco.repo.version.VersionModel; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.version.Version; -import org.alfresco.service.cmr.version.VersionType; - -/** - * Declare as record version integration tests - * - * @author Roy Wetherall - * @since 2.3 - */ -public class DeclareAsRecordVersionTest extends RecordableVersionsBaseTest -{ - /** recordable version service */ - private RecordableVersionService recordableVersionService; - - /** - * @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase#initServices() - */ - @Override - protected void initServices() - { - super.initServices(); - recordableVersionService = (RecordableVersionService)applicationContext.getBean("RecordableVersionService"); - } - - /** - * Given versionable content with a non-recorded latest version - * When I declare a version record - * Then the latest version is recorded and a record is created - */ - public void testDeclareLatestVersionAsRecord() - { - doBehaviourDrivenTest(new BehaviourDrivenTest(dmCollaborator) - { - private NodeRef versionRecord; - private Map versionProperties; - - public void given() throws Exception - { - // setup version properties - versionProperties = new HashMap(4); - versionProperties.put(Version.PROP_DESCRIPTION, DESCRIPTION); - versionProperties.put(VersionModel.PROP_VERSION_TYPE, VersionType.MINOR); - - // create version - versionService.createVersion(dmDocument, versionProperties); - - // assert that the latest version is not recorded - assertFalse(recordableVersionService.isCurrentVersionRecorded(dmDocument)); - } - - public void when() - { - // create version record from latest version - versionRecord = recordableVersionService.createRecordFromLatestVersion(filePlan, dmDocument); - } - - public void then() - { - // check the created record - assertNotNull(versionRecord); - assertTrue(recordService.isRecord(versionRecord)); - - // assert the current version is recorded - assertTrue(recordableVersionService.isCurrentVersionRecorded(dmDocument)); - - // check the recorded version - checkRecordedVersion(dmDocument, DESCRIPTION, "0.1"); - } - }); - } - - /** - * Given versionable content with a recorded latest version - * When I delcare a version record - * Then nothing happens since the latest version is already recorded - * And a warning is logged - */ - public void testDeclareLatestVersionAsRecordButAlreadyRecorded() - { - doBehaviourDrivenTest(new BehaviourDrivenTest(dmCollaborator) - { - private NodeRef versionRecord; - private Map versionProperties; - - public void given() throws Exception - { - // setup version properties - versionProperties = new HashMap(4); - versionProperties.put(Version.PROP_DESCRIPTION, DESCRIPTION); - versionProperties.put(VersionModel.PROP_VERSION_TYPE, VersionType.MINOR); - versionProperties.put(RecordableVersionServiceImpl.KEY_RECORDABLE_VERSION, true); - versionProperties.put(RecordableVersionServiceImpl.KEY_FILE_PLAN, filePlan); - - // create version - versionService.createVersion(dmDocument, versionProperties); - - // assert that the latest version is not recorded - assertTrue(recordableVersionService.isCurrentVersionRecorded(dmDocument)); - } - - public void when() - { - // create version record from latest version - versionRecord = recordableVersionService.createRecordFromLatestVersion(filePlan, dmDocument); - } - - public void then() - { - // check that a record was not created - assertNull(versionRecord); - - // assert the current version is recorded - assertTrue(recordableVersionService.isCurrentVersionRecorded(dmDocument)); - - // check the recorded version - checkRecordedVersion(dmDocument, DESCRIPTION, "0.1"); - } - }); - } - - -} diff --git a/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/version/RecordableVersionsBaseTest.java b/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/version/RecordableVersionsBaseTest.java deleted file mode 100644 index 767f3d2ec8..0000000000 --- a/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/integration/version/RecordableVersionsBaseTest.java +++ /dev/null @@ -1,262 +0,0 @@ -/* - * Copyright (C) 2005-2014 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - */ -package org.alfresco.module.org_alfresco_module_rm.test.integration.version; - -import java.io.Serializable; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Map; -import java.util.Set; - -import org.alfresco.model.ContentModel; -import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase; -import org.alfresco.module.org_alfresco_module_rm.version.RecordableVersionModel; -import org.alfresco.module.org_alfresco_module_rm.version.RecordableVersionServiceImpl; -import org.alfresco.repo.content.MimetypeMap; -import org.alfresco.service.cmr.repository.ContentWriter; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.version.Version; -import org.alfresco.service.cmr.version.VersionHistory; -import org.alfresco.service.namespace.NamespaceService; -import org.alfresco.service.namespace.QName; -import org.alfresco.util.PropertyMap; - -/** - * @author Roy Wetherall - * @since 2.3 - */ -public abstract class RecordableVersionsBaseTest extends BaseRMTestCase implements RecordableVersionModel -{ - protected static final QName QNAME_PUBLISHER = QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, "publisher"); - protected static final QName QNAME_SUBJECT = QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, "subject"); - - protected static final String DESCRIPTION = "description"; - protected static final String PUBLISHER = "publisher"; - protected static final String SUBJECT = "subject"; - protected static final String OWNER = "GracieWetherall"; - - protected static final String CONTENT = - "Simple + Smart. A smarter way to build, a smarter way to deploy. Its simple because we focus on the end " - + "user and smart because we support more open standards than any other ECM platform, while delivering all " - + "the value a traditional platform provides."; - - /** - * @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase#isCollaborationSiteTest() - */ - @Override - protected boolean isCollaborationSiteTest() - { - return true; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase#setupCollaborationSiteTestDataImpl() - */ - @Override - protected void setupCollaborationSiteTestDataImpl() - { - super.setupCollaborationSiteTestDataImpl(); - - // create authentication for owner - createPerson(OWNER); - - // add titled aspect - PropertyMap titledProperties = new PropertyMap(2); - titledProperties.put(ContentModel.PROP_TITLE, "document title"); - titledProperties.put(ContentModel.PROP_DESCRIPTION, "document description"); - nodeService.addAspect(dmDocument, ContentModel.ASPECT_TITLED, titledProperties); - - // add ownable aspect - PropertyMap ownableProperties = new PropertyMap(1); - ownableProperties.put(ContentModel.PROP_OWNER, OWNER); - nodeService.addAspect(dmDocument, ContentModel.ASPECT_OWNABLE, ownableProperties); - - // add Dublin core aspect - PropertyMap dublinCoreProperties = new PropertyMap(2); - dublinCoreProperties.put(QNAME_PUBLISHER, PUBLISHER); - dublinCoreProperties.put(QNAME_SUBJECT, SUBJECT); - nodeService.addAspect(dmDocument, ContentModel.ASPECT_DUBLINCORE, dublinCoreProperties); - - // add content - ContentWriter writer = contentService.getWriter(dmDocument, ContentModel.PROP_CONTENT, true); - writer.setEncoding("UTF-8"); - writer.setMimetype(MimetypeMap.MIMETYPE_TEXT_PLAIN); - writer.putContent(CONTENT); - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase#tearDownImpl() - */ - @Override - protected void tearDownImpl() - { - super.tearDownImpl(); - - // remove owner - personService.deletePerson(OWNER); - } - - /** - * Helper to check that the current version is recorded - */ - protected void checkRecordedVersion(NodeRef document, String description, String versionLabel) - { - // double check that the document is not a record - assertFalse(recordService.isRecord(document)); - - // store document state - Map beforeProperties = nodeService.getProperties(document); - Set beforeAspects = nodeService.getAspects(dmDocument); - - // get the current version - Version version = versionService.getCurrentVersion(document); - - // version has been created - assertNotNull(version); - - // check the version properties - assertEquals(description, version.getDescription()); - assertEquals(versionLabel, version.getVersionLabel()); - - // get the frozen state - NodeRef frozen = version.getFrozenStateNodeRef(); - - // check the properties - checkProperties(frozen, beforeProperties); - - // compare aspects - checkAspects(frozen, beforeAspects); - - // record version node reference is available on version - NodeRef record = (NodeRef)version.getVersionProperties().get(RecordableVersionServiceImpl.PROP_VERSION_RECORD); - assertNotNull(record); - - // check that the version record information has been added - assertTrue(nodeService.hasAspect(record, ASPECT_VERSION_RECORD)); - assertEquals(versionLabel, nodeService.getProperty(record, RecordableVersionModel.PROP_VERSION_LABEL)); - assertEquals(description, nodeService.getProperty(record, RecordableVersionModel.PROP_VERSION_DESCRIPTION)); - - // record version is an unfiled record - assertTrue(recordService.isRecord(record)); - assertFalse(recordService.isFiled(record)); - - // check that the created record does not have either of the versionable aspects - assertFalse(nodeService.hasAspect(record, RecordableVersionModel.ASPECT_VERSIONABLE)); - - // check the version history - VersionHistory versionHistory = versionService.getVersionHistory(document); - assertNotNull(versionHistory); - Version headVersion = versionHistory.getHeadVersion(); - assertNotNull(headVersion); - } - - /** - * Helper method to check that the current version is not recorded - */ - protected void checkNotRecordedAspect(NodeRef document, String description, String versionLabel) - { - // double check that the document is not a record - assertFalse(recordService.isRecord(document)); - - // get the current version - Version version = versionService.getCurrentVersion(document); - - // version has been created - assertNotNull(version); - - // check the version properties - assertEquals(description, version.getDescription()); - assertEquals(versionLabel, version.getVersionLabel()); - - // record version node reference is available on version - NodeRef record = (NodeRef)version.getVersionProperties().get(RecordableVersionServiceImpl.PROP_VERSION_RECORD); - assertNull(record); - - // check the version history - VersionHistory versionHistory = versionService.getVersionHistory(document); - assertNotNull(versionHistory); - Version headVersion = versionHistory.getHeadVersion(); - assertNotNull(headVersion); - } - - /** - * Helper to check the properties of a recorded version - */ - protected void checkProperties(NodeRef frozen, Map beforeProperies) - { - Map frozenProperties = nodeService.getProperties(frozen); - Map cloneFrozenProperties = new HashMap(frozenProperties); - for (Map.Entry entry : beforeProperies.entrySet()) - { - QName beforePropertyName = entry.getKey(); - if (frozenProperties.containsKey(beforePropertyName)) - { - Serializable frozenValue = frozenProperties.get(beforePropertyName); - assertEquals("Frozen property " + beforePropertyName.getLocalName() + " value is incorrect.", entry.getValue(), frozenValue); - cloneFrozenProperties.remove(beforePropertyName); - } - else if (!PROP_FILE_PLAN.equals(beforePropertyName) && - !PROP_RECORDABLE_VERSION_POLICY.equals(beforePropertyName) && - !ContentModel.PROP_AUTO_VERSION_PROPS.equals(beforePropertyName) && - !ContentModel.PROP_AUTO_VERSION.equals(beforePropertyName) && - !ContentModel.PROP_INITIAL_VERSION.equals(beforePropertyName)) - { - fail("Property missing from frozen state .. " + beforePropertyName); - } - } - - // filter out missing properties with null values - for (Map.Entry entry : frozenProperties.entrySet()) - { - if (entry.getValue() == null) - { - cloneFrozenProperties.remove(entry.getKey()); - } - } - - - // frozen properties should be empty - assertTrue("Properties in frozen state, but not in origional. " + cloneFrozenProperties.keySet(), cloneFrozenProperties.isEmpty()); - } - - /** - * Helper to check the aspects of a recorded version - */ - protected void checkAspects(NodeRef frozen, Set beforeAspects) - { - Set cloneBeforeAspects = new HashSet(beforeAspects); - - // compare origional and frozen aspects - Set frozenAspects = nodeService.getAspects(frozen); - cloneBeforeAspects.removeAll(frozenAspects); - cloneBeforeAspects.remove(RecordableVersionModel.ASPECT_VERSIONABLE); - cloneBeforeAspects.remove(ContentModel.ASPECT_VERSIONABLE); - if (!cloneBeforeAspects.isEmpty()) - { - fail("Aspects not present in frozen state. " + cloneBeforeAspects.toString()); - } - - frozenAspects.removeAll(beforeAspects); - if (!frozenAspects.isEmpty()) - { - fail("Aspects in the frozen state, but not in origional. " + frozenAspects.toString()); - } - } - -} diff --git a/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/action/ActionTestSuite.java b/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/action/ActionTestSuite.java index 47b44bcab7..c9fdd2b62a 100644 --- a/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/action/ActionTestSuite.java +++ b/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/action/ActionTestSuite.java @@ -36,8 +36,7 @@ import org.junit.runners.Suite.SuiteClasses; HideRecordActionTest.class, RejectActionTest.class, FileToActionTest.class, - FileReportActionTest.class, - RecordableVersionConfigActionTest.class + FileReportActionTest.class }) public class ActionTestSuite { diff --git a/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/action/HideRecordActionTest.java b/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/action/HideRecordActionTest.java index 8660f761b5..db2d00e3d4 100644 --- a/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/action/HideRecordActionTest.java +++ b/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/action/HideRecordActionTest.java @@ -21,7 +21,9 @@ package org.alfresco.module.org_alfresco_module_rm.test.legacy.action; import org.alfresco.model.ContentModel; import org.alfresco.module.org_alfresco_module_rm.action.dm.CreateRecordAction; import org.alfresco.module.org_alfresco_module_rm.action.dm.HideRecordAction; +import org.alfresco.module.org_alfresco_module_rm.role.Role; import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase; +import org.alfresco.repo.security.authentication.AuthenticationUtil; import org.alfresco.service.cmr.action.Action; import org.alfresco.service.cmr.repository.NodeRef; @@ -47,6 +49,19 @@ public class HideRecordActionTest extends BaseRMTestCase public void testHideRecordAction() { + doTestInTransaction(new Test() + { + public Void run() + { + // The user must have the appropriate rights + Role role = filePlanRoleService.getRole(filePlan, "RecordsManager"); + authorityService.addAuthority(role.getRoleGroupName(), dmCollaborator); + + return null; + } + }, + AuthenticationUtil.getAdminUserName()); + doTestInTransaction(new Test() { public Void run() diff --git a/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/action/MoveRecordActionTest.java b/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/action/MoveRecordActionTest.java deleted file mode 100644 index 71c7a50c81..0000000000 --- a/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/action/MoveRecordActionTest.java +++ /dev/null @@ -1,103 +0,0 @@ -/* - * Copyright (C) 2005-2014 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - */ -package org.alfresco.module.org_alfresco_module_rm.test.legacy.action; - -import org.alfresco.model.ContentModel; -import org.alfresco.module.org_alfresco_module_rm.action.dm.CreateRecordAction; -import org.alfresco.module.org_alfresco_module_rm.action.dm.MoveDmRecordAction; -import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase; -import org.alfresco.service.cmr.action.Action; -import org.alfresco.service.cmr.repository.ChildAssociationRef; -import org.alfresco.service.cmr.repository.NodeRef; - -/** - * Move Record Action Unit Test. - * - * @author Tuna Aksoy - * @since 2.2 - */ -public class MoveRecordActionTest extends BaseRMTestCase -{ - @Override - protected boolean isUserTest() - { - return true; - } - - @Override - protected boolean isCollaborationSiteTest() - { - return true; - } - - public void testMoveRecordAction() - { - doTestInTransaction(new Test() - { - public Void run() - { - // Create a new folder in a collaboration site - NodeRef testFolder = fileFolderService.create(dmFolder, "myTestFolder", ContentModel.TYPE_FOLDER).getNodeRef(); - - // Create a document so that the user has the write permissions for that document - NodeRef document = fileFolderService.create(testFolder, "moveFile.txt", ContentModel.TYPE_CONTENT).getNodeRef(); - - // Create destination folder - String destination = fileFolderService.create(testFolder, "newDest", ContentModel.TYPE_FOLDER).getNodeRef().toString(); - - // Create a record from that document - Action createAction = actionService.createAction(CreateRecordAction.NAME); - createAction.setParameterValue(CreateRecordAction.PARAM_FILE_PLAN, filePlan); - actionService.executeAction(createAction, document); - - // Check if the document is a record now - assertTrue(recordService.isRecord(document)); - - // The record should have the original location information - assertNotNull(nodeService.getProperty(document, PROP_RECORD_ORIGINATING_LOCATION)); - - // Check the parents. In this case the document should have two parents (doclib and fileplan) - assertEquals(nodeService.getParentAssocs(document).size(), 2); - - // Check the number of children of dmFolder before move - assertEquals(nodeService.getChildAssocs(testFolder).size(), 2); - - // Move the record - Action moveRecordAction = actionService.createAction(MoveDmRecordAction.NAME); - moveRecordAction.setParameterValue(MoveDmRecordAction.PARAM_TARGET_NODE_REF, destination); - actionService.executeAction(moveRecordAction, document); - - // Check the number of children of dmFolder after move - assertEquals(nodeService.getChildAssocs(testFolder).size(), 1); - - // Check the new document parent - ChildAssociationRef parent1 = nodeService.getParentAssocs(document).get(0); - ChildAssociationRef parent2 = nodeService.getParentAssocs(document).get(1); - NodeRef newDocParent = (parent1.isPrimary() ? parent2 : parent1).getParentRef(); - assertEquals(destination, newDocParent.toString()); - - // Check if the original location information has been updated - assertEquals((NodeRef) nodeService.getProperty(document, PROP_RECORD_ORIGINATING_LOCATION), newDocParent); - - return null; - } - }, - dmCollaborator); - } -} diff --git a/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/action/RecordableVersionConfigActionTest.java b/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/action/RecordableVersionConfigActionTest.java deleted file mode 100644 index 448c00aa27..0000000000 --- a/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/action/RecordableVersionConfigActionTest.java +++ /dev/null @@ -1,143 +0,0 @@ -/* - * Copyright (C) 2005-2014 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - */ -package org.alfresco.module.org_alfresco_module_rm.test.legacy.action; - -import static org.alfresco.module.org_alfresco_module_rm.action.dm.RecordableVersionConfigAction.NAME; -import static org.alfresco.module.org_alfresco_module_rm.action.dm.RecordableVersionConfigAction.PARAM_VERSION; -import static org.alfresco.module.org_alfresco_module_rm.version.RecordableVersionModel.PROP_RECORDABLE_VERSION_POLICY; -import static org.alfresco.module.org_alfresco_module_rm.version.RecordableVersionPolicy.ALL; -import static org.alfresco.module.org_alfresco_module_rm.version.RecordableVersionPolicy.MAJOR_ONLY; -import static org.alfresco.module.org_alfresco_module_rm.version.RecordableVersionPolicy.NONE; - -import org.alfresco.model.ContentModel; -import org.alfresco.module.org_alfresco_module_rm.action.dm.CreateRecordAction; -import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase; -import org.alfresco.service.cmr.action.Action; -import org.alfresco.service.cmr.repository.NodeRef; - -/** - * Recordable version config action test - * - * @author Tuna Aksoy - * @since 2.3 - */ -public class RecordableVersionConfigActionTest extends BaseRMTestCase -{ - /** - * @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase#isUserTest() - */ - @Override - protected boolean isUserTest() - { - return true; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase#isCollaborationSiteTest() - */ - @Override - protected boolean isCollaborationSiteTest() - { - return true; - } - - public void testRecordableVersionConfigAction() - { - // Uncommented due to the failures on bamboo. Also this is related to RM-1758 - /* - doTestInTransaction(new Test() - { - final NodeRef document1 = fileFolderService.create(dmFolder, "aDocument", ContentModel.TYPE_CONTENT).getNodeRef(); - public Void run() - { - Action action = actionService.createAction(NAME); - action.setParameterValue(PARAM_VERSION, MAJOR_ONLY.toString()); - actionService.executeAction(action, document1); - return null; - } - - public void test(Void result) throws Exception - { - Serializable version = nodeService.getProperty(document1, PROP_RECORDABLE_VERSION_POLICY); - assertNotNull(version); - assertEquals(MAJOR_ONLY.toString(), (String) version); - }; - }, - dmCollaborator); - */ - - doTestInTransaction(new Test() - { - public Void run() - { - Action action = actionService.createAction(NAME); - action.setParameterValue(PARAM_VERSION, ALL.toString()); - actionService.executeAction(action, dmFolder); - return null; - } - - public void test(Void result) throws Exception - { - assertNull(nodeService.getProperty(dmFolder, PROP_RECORDABLE_VERSION_POLICY)); - }; - }, - dmCollaborator); - - doTestInTransaction(new Test() - { - final NodeRef document2 = fileFolderService.create(dmFolder, "another document", ContentModel.TYPE_CONTENT).getNodeRef(); - public Void run() - { - Action action = actionService.createAction(NAME); - action.setParameterValue(PARAM_VERSION, NONE.toString()); - actionService.executeAction(action, document2); - return null; - } - - public void test(Void result) throws Exception - { - assertNull(nodeService.getProperty(document2, PROP_RECORDABLE_VERSION_POLICY)); - }; - }, - dmCollaborator); - - - doTestInTransaction(new Test() - { - final NodeRef document3 = fileFolderService.create(dmFolder, "testfile.txt", ContentModel.TYPE_CONTENT).getNodeRef(); - public Void run() - { - Action createAction = actionService.createAction(CreateRecordAction.NAME); - createAction.setParameterValue(CreateRecordAction.PARAM_FILE_PLAN, filePlan); - actionService.executeAction(createAction, document3); - - Action action = actionService.createAction(NAME); - action.setParameterValue(PARAM_VERSION, MAJOR_ONLY.toString()); - actionService.executeAction(action, document3); - return null; - } - - public void test(Void result) throws Exception - { - assertNull(nodeService.getProperty(document3, PROP_RECORDABLE_VERSION_POLICY)); - }; - }, - dmCollaborator); - } -} diff --git a/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/service/CapabilityServiceImplTest.java b/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/service/CapabilityServiceImplTest.java index 42b884683a..640093da54 100644 --- a/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/service/CapabilityServiceImplTest.java +++ b/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/service/CapabilityServiceImplTest.java @@ -34,6 +34,58 @@ import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase; */ public class CapabilityServiceImplTest extends BaseRMTestCase { + public void testGetCapability() throws Exception + { + doTestInTransaction(new Test() + { + @Override + public Void run() throws Exception + { + // FIXME + return null; + } + }); + } + + public void testGetCapabilities() throws Exception + { + doTestInTransaction(new Test() + { + @Override + public Void run() throws Exception + { + // FIXME + return null; + } + }); + } + + public void testGetCapabilityAccessState() throws Exception + { + doTestInTransaction(new Test() + { + @Override + public Void run() throws Exception + { + // FIXME + return null; + } + }); + } + + public void testGetCapabilitiesAccessState() throws Exception + { + doTestInTransaction(new Test() + { + @Override + public Void run() throws Exception + { + // FIXME + return null; + } + }); + } + public void testGetAddRemoveGroups() throws Exception { doTestInTransaction(new Test() diff --git a/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/service/DispositionServiceImplTest.java b/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/service/DispositionServiceImplTest.java index a2cdf3cdb7..9d05b218c3 100644 --- a/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/service/DispositionServiceImplTest.java +++ b/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/service/DispositionServiceImplTest.java @@ -981,16 +981,10 @@ public class DispositionServiceImplTest extends BaseRMTestCase @Override public void test(DispositionActionDefinition result) throws Exception { - DispositionActionDefinition actionDefinition = testRM386DispositionSchedule.getDispositionActionDefinitionByName("cutoff"); - assertNotNull(actionDefinition); - assertTrue(nodeService.hasAspect(actionDefinition.getNodeRef(), ASPECT_UNPUBLISHED_UPDATE)); - // Publish the updates PublishUpdatesJobExecuter updater = (PublishUpdatesJobExecuter)applicationContext.getBean("publishUpdatesJobExecuter"); updater.executeImpl(); - assertFalse(nodeService.hasAspect(actionDefinition.getNodeRef(), ASPECT_UNPUBLISHED_UPDATE)); - // Check the record has been updated DispositionAction dispositionAction = dispositionService.getNextDispositionAction(testRM386Record); assertNotNull(dispositionAction); diff --git a/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/service/RecordServiceImplTest.java b/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/service/RecordServiceImplTest.java index 14f5ffa379..aac8a820f7 100644 --- a/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/service/RecordServiceImplTest.java +++ b/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/service/RecordServiceImplTest.java @@ -95,7 +95,7 @@ public class RecordServiceImplTest extends BaseRMTestCase { Set aspects = recordService.getRecordMetadataAspects(filePlan); assertNotNull(aspects); - assertEquals(1, aspects.size()); + assertEquals(2, aspects.size()); assertTrue(aspects.containsAll(getAspectList())); return null; diff --git a/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/service/RecordsManagementAdminServiceImplTest.java b/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/service/RecordsManagementAdminServiceImplTest.java index a2790fac5b..fe6c63716a 100644 --- a/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/service/RecordsManagementAdminServiceImplTest.java +++ b/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/service/RecordsManagementAdminServiceImplTest.java @@ -25,25 +25,24 @@ import java.util.List; import java.util.Map; import java.util.Set; +import org.alfresco.module.org_alfresco_module_rm.admin.CustomMetadataException; +import org.alfresco.module.org_alfresco_module_rm.admin.RecordsManagementAdminService; import org.alfresco.module.org_alfresco_module_rm.RecordsManagementPolicies; import org.alfresco.module.org_alfresco_module_rm.RecordsManagementPolicies.BeforeCreateReference; import org.alfresco.module.org_alfresco_module_rm.RecordsManagementPolicies.OnCreateReference; -import org.alfresco.module.org_alfresco_module_rm.admin.CustomMetadataException; -import org.alfresco.module.org_alfresco_module_rm.admin.RecordsManagementAdminService; import org.alfresco.module.org_alfresco_module_rm.caveat.RMListOfValuesConstraint; import org.alfresco.module.org_alfresco_module_rm.caveat.RMListOfValuesConstraint.MatchLogic; import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementCustomModel; import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; -import org.alfresco.module.org_alfresco_module_rm.relationship.RelationshipDefinition; -import org.alfresco.module.org_alfresco_module_rm.relationship.RelationshipDisplayName; -import org.alfresco.module.org_alfresco_module_rm.relationship.RelationshipType; +import org.alfresco.module.org_alfresco_module_rm.script.CustomReferenceType; import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMTestCase; -import org.alfresco.repo.policy.Behaviour.NotificationFrequency; import org.alfresco.repo.policy.JavaBehaviour; +import org.alfresco.repo.policy.Behaviour.NotificationFrequency; import org.alfresco.repo.security.authentication.AuthenticationUtil; import org.alfresco.repo.transaction.RetryingTransactionHelper; import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback; import org.alfresco.service.cmr.dictionary.AspectDefinition; +import org.alfresco.service.cmr.dictionary.AssociationDefinition; import org.alfresco.service.cmr.dictionary.Constraint; import org.alfresco.service.cmr.dictionary.ConstraintDefinition; import org.alfresco.service.cmr.dictionary.DataTypeDefinition; @@ -532,16 +531,16 @@ public class RecordsManagementAdminServiceImplTest extends BaseRMTestCase public void testCreateAndUseCustomChildReference() throws Exception { long now = System.currentTimeMillis(); - createAndUseCustomReference(RelationshipType.PARENTCHILD, null, "superseded" + now, "superseding" + now); + createAndUseCustomReference(CustomReferenceType.PARENT_CHILD, null, "superseded" + now, "superseding" + now); } public void testCreateAndUseCustomNonChildReference() throws Exception { long now = System.currentTimeMillis(); - createAndUseCustomReference(RelationshipType.BIDIRECTIONAL, "supporting" + now, null, null); + createAndUseCustomReference(CustomReferenceType.BIDIRECTIONAL, "supporting" + now, null, null); } - private void createAndUseCustomReference(final RelationshipType refType, final String label, final String source, final String target) throws Exception + private void createAndUseCustomReference(final CustomReferenceType refType, final String label, final String source, final String target) throws Exception { final NodeRef testRecord1 = retryingTransactionHelper.doInTransaction(new RetryingTransactionHelper.RetryingTransactionCallback() { @@ -573,25 +572,18 @@ public class RecordsManagementAdminServiceImplTest extends BaseRMTestCase if (source != null) params.put("source", source); if (target != null) params.put("target", target); - // Create the relationship display name - RelationshipDisplayName displayName; + // Create the reference definition. + QName qNameResult; if (label != null) { // A bidirectional reference - displayName = new RelationshipDisplayName(label, label); + qNameResult = rmAdminService.addCustomAssocDefinition(label); } else { // A parent/child reference - displayName = new RelationshipDisplayName(source, target); + qNameResult = rmAdminService.addCustomChildAssocDefinition(source, target); } - - // Create the relationship definition - RelationshipDefinition relationshipDefinition = relationshipService.createRelationshipDefinition(displayName); - - // Get the qualified name - QName qNameResult = QName.createQName(RM_CUSTOM_PREFIX, relationshipDefinition.getUniqueName(), namespaceService);; - System.out.println("Creating new " + refType + " reference definition: " + qNameResult); System.out.println(" params- label: '" + label + "' source: '" + source + "' target: '" + target + "'"); @@ -603,16 +595,21 @@ public class RecordsManagementAdminServiceImplTest extends BaseRMTestCase { public Void execute() throws Throwable { - RelationshipDefinition relationshipDefinition = relationshipService.getRelationshipDefinition(generatedQName.getLocalName()); - assertNotNull("Relationship definition from relationshipService was null.", relationshipDefinition); - assertEquals(generatedQName.getLocalName(), relationshipDefinition.getUniqueName()); - assertTrue(refType.equals(relationshipDefinition.getType())); + // Confirm the custom reference is included in the list from adminService. + Map customRefDefinitions = rmAdminService.getCustomReferenceDefinitions(); + AssociationDefinition retrievedRefDefn = customRefDefinitions.get(generatedQName); + assertNotNull("Custom reference definition from adminService was null.", retrievedRefDefn); + assertEquals(generatedQName, retrievedRefDefn.getName()); + assertEquals(refType.equals(CustomReferenceType.PARENT_CHILD), retrievedRefDefn.isChild()); // Now we need to use the custom reference. // So we apply the aspect containing it to our test records. nodeService.addAspect(testRecord1, ASPECT_CUSTOM_ASSOCIATIONS, null); - if (RelationshipType.PARENTCHILD.equals(refType)) + QName assocsAspectQName = QName.createQName("rmc:customAssocs", namespaceService); + nodeService.addAspect(testRecord1, assocsAspectQName, null); + + if (CustomReferenceType.PARENT_CHILD.equals(refType)) { nodeService.addChild(testRecord1, testRecord2, generatedQName, generatedQName); } @@ -633,7 +630,7 @@ public class RecordsManagementAdminServiceImplTest extends BaseRMTestCase List retrievedAssocs = nodeService.getTargetAssocs(testRecord1, RegexQNamePattern.MATCH_ALL); Object newlyAddedRef = null; - if (RelationshipType.PARENTCHILD.equals(refType)) + if (CustomReferenceType.PARENT_CHILD.equals(refType)) { for (ChildAssociationRef caRef : childAssocs) { @@ -654,7 +651,7 @@ public class RecordsManagementAdminServiceImplTest extends BaseRMTestCase // Check that the reference has appeared in the data dictionary AspectDefinition customAssocsAspect = dictionaryService.getAspect(ASPECT_CUSTOM_ASSOCIATIONS); assertNotNull(customAssocsAspect); - if (RelationshipType.PARENTCHILD.equals(refType)) + if (CustomReferenceType.PARENT_CHILD.equals(refType)) { assertNotNull("The customReference is not returned from the dictionaryService.", customAssocsAspect.getChildAssociations().get(generatedQName)); @@ -699,17 +696,13 @@ public class RecordsManagementAdminServiceImplTest extends BaseRMTestCase public Void execute() throws Throwable { // Just dump them out for visual inspection - System.out.println("Available relationship definitions:"); - Set relationshipDefinitions = relationshipService.getRelationshipDefinitions(); - for (RelationshipDefinition relationshipDefinition : relationshipDefinitions) + System.out.println("Available custom references:"); + Map references = rmAdminService.getCustomReferenceDefinitions(); + for (QName reference : references.keySet()) { - String uniqueName = relationshipDefinition.getUniqueName(); - RelationshipDisplayName displayName = relationshipDefinition.getDisplayName(); - - System.out.println(" - " + uniqueName); - System.out.println(" " + displayName.toString()); + System.out.println(" - " + reference.toString()); + System.out.println(" " + references.get(reference).getTitle(dictionaryService)); } - return null; } }); @@ -777,7 +770,7 @@ public class RecordsManagementAdminServiceImplTest extends BaseRMTestCase assertFalse(beforeMarker); assertFalse(onMarker); - relationshipService.addRelationship(CUSTOM_REF_VERSIONS.getLocalName(), testRecord1, testRecord2); + rmAdminService.addCustomReference(testRecord1, testRecord2, CUSTOM_REF_VERSIONS); assertTrue(beforeMarker); assertTrue(onMarker); diff --git a/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/webscript/RmClassesRestApiTest.java b/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/webscript/RmClassesRestApiTest.java index 40e9faac02..e5021d43a6 100644 --- a/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/webscript/RmClassesRestApiTest.java +++ b/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/webscript/RmClassesRestApiTest.java @@ -139,7 +139,7 @@ public class RmClassesRestApiTest extends BaseRMWebScriptTestCase "emailserver:attached", "bpm:assignees", "cm:likesRatingSchemeRollups", - "wf:parallelReviewStats", + "wcmwf:submission", "sys:localized" }); } diff --git a/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/webscript/RmPropertiesRestApiTest.java b/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/webscript/RmPropertiesRestApiTest.java index 820e28aa6d..f086c27435 100644 --- a/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/webscript/RmPropertiesRestApiTest.java +++ b/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/webscript/RmPropertiesRestApiTest.java @@ -139,8 +139,8 @@ public class RmPropertiesRestApiTest extends BaseRMWebScriptTestCase "cm:authority", "sys:descriptor", "app:folderlink", - "wf:submitGroupReviewTask", - "cmis:policy" + "wcmwf:parallelReviewTask", + "wca:deploymentserver" }); } } diff --git a/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/webscript/RmRestApiTest.java b/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/webscript/RmRestApiTest.java index f4d3eb5bc0..cb64ba01bf 100644 --- a/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/webscript/RmRestApiTest.java +++ b/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/legacy/webscript/RmRestApiTest.java @@ -25,9 +25,10 @@ import java.text.MessageFormat; import java.util.Date; import java.util.Map; +import org.alfresco.module.org_alfresco_module_rm.admin.RecordsManagementAdminServiceImpl; import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementCustomModel; import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; -import org.alfresco.module.org_alfresco_module_rm.relationship.RelationshipType; +import org.alfresco.module.org_alfresco_module_rm.script.CustomReferenceType; import org.alfresco.module.org_alfresco_module_rm.test.util.BaseRMWebScriptTestCase; import org.alfresco.module.org_alfresco_module_rm.test.util.TestActionParams; import org.alfresco.service.cmr.dictionary.AspectDefinition; @@ -64,11 +65,59 @@ public class RmRestApiTest extends BaseRMWebScriptTestCase implements RecordsMan protected static final String APPLICATION_JSON = "application/json"; protected static final String RMA_CUSTOM_PROPS_DEFINITIONS_URL = "/api/rma/admin/custompropertydefinitions"; protected static final String RMA_CUSTOM_REFS_DEFINITIONS_URL = "/api/rma/admin/customreferencedefinitions"; +// protected NamespaceService namespaceService; +// protected NodeService nodeService; +// protected ContentService contentService; +// protected DictionaryService dictionaryService; +// protected SearchService searchService; +// protected ImporterService importService; +// protected TransactionService transactionService; +// protected ServiceRegistry services; +// protected RecordsManagementActionService rmActionService; +// protected RecordsManagementAuditService rmAuditService; +// protected RecordsManagementAdminService rmAdminService; +// protected RetryingTransactionHelper transactionHelper; +// protected DispositionService dispositionService; private static final String BI_DI = "BiDi"; private static final String CHILD_SRC = "childSrc"; private static final String CHILD_TGT = "childTgt"; +// @Override +// protected void setUp() throws Exception +// { +// setCustomContext("classpath:test-context.xml"); +// +// super.setUp(); +// this.namespaceService = (NamespaceService) getServer().getApplicationContext().getBean("NamespaceService"); +// this.nodeService = (NodeService) getServer().getApplicationContext().getBean("NodeService"); +// this.contentService = (ContentService)getServer().getApplicationContext().getBean("ContentService"); +// this.dictionaryService = (DictionaryService)getServer().getApplicationContext().getBean("DictionaryService"); +// this.searchService = (SearchService)getServer().getApplicationContext().getBean("SearchService"); +// this.importService = (ImporterService)getServer().getApplicationContext().getBean("ImporterService"); +// this.transactionService = (TransactionService)getServer().getApplicationContext().getBean("TransactionService"); +// this.services = (ServiceRegistry)getServer().getApplicationContext().getBean("ServiceRegistry"); +// this.rmActionService = (RecordsManagementActionService)getServer().getApplicationContext().getBean("RecordsManagementActionService"); +// this.rmAuditService = (RecordsManagementAuditService)getServer().getApplicationContext().getBean("RecordsManagementAuditService"); +// this.rmAdminService = (RecordsManagementAdminService)getServer().getApplicationContext().getBean("RecordsManagementAdminService"); +// transactionHelper = (RetryingTransactionHelper)getServer().getApplicationContext().getBean("retryingTransactionHelper"); +// dispositionService = (DispositionService)getServer().getApplicationContext().getBean("DispositionService"); +// +// AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getSystemUserName()); +// +// // Bring the filePlan into the test database. +// // +// // This is quite a slow call, so if this class grew to have many test methods, +// // there would be a real benefit in using something like @BeforeClass for the line below. +// transactionHelper.doInTransaction(new RetryingTransactionHelper.RetryingTransactionCallback() +// { +// public NodeRef execute() throws Throwable +// { +// return TestUtilities.loadFilePlanData(getServer().getApplicationContext()); +// } +// }); +// } + /** * This test method ensures that a POST of an RM action to a non-existent node * will result in a 404 status. @@ -214,7 +263,7 @@ public class RmRestApiTest extends BaseRMWebScriptTestCase implements RecordsMan // 1. Child association. String jsonString = new JSONStringer().object() - .key("referenceType").value(RelationshipType.PARENTCHILD) + .key("referenceType").value(CustomReferenceType.PARENT_CHILD) .key("source").value(CHILD_SRC) .key("target").value(CHILD_TGT) .endObject() @@ -238,7 +287,7 @@ public class RmRestApiTest extends BaseRMWebScriptTestCase implements RecordsMan // 2. Non-child or standard association. jsonString = new JSONStringer().object() - .key("referenceType").value(RelationshipType.BIDIRECTIONAL) + .key("referenceType").value(CustomReferenceType.BIDIRECTIONAL) .key("label").value(BI_DI) .endObject() .toString(); @@ -259,7 +308,8 @@ public class RmRestApiTest extends BaseRMWebScriptTestCase implements RecordsMan result[1] = generatedBidiRefId; // Now assert that both have appeared in the data dictionary. - AspectDefinition customAssocsAspect = dictionaryService.getAspect(ASPECT_CUSTOM_ASSOCIATIONS); + AspectDefinition customAssocsAspect = + dictionaryService.getAspect(QName.createQName(RecordsManagementAdminServiceImpl.RMC_CUSTOM_ASSOCS, namespaceService)); assertNotNull("Missing customAssocs aspect", customAssocsAspect); QName newRefQname = adminService.getQNameForClientId(generatedChildRefId); @@ -426,12 +476,16 @@ public class RmRestApiTest extends BaseRMWebScriptTestCase implements RecordsMan JSONArray customRefsObj = (JSONArray)dataObj.get("customReferences"); assertNotNull("JSON 'customReferences' object was null", customRefsObj); +// for (int i = 0; i < customRefsObj.length(); i++) { +// System.out.println(customRefsObj.getString(i)); +// } + assertTrue("There should be at least two custom references. Found " + customRefsObj, customRefsObj.length() >= 2); // GET a specific custom reference definition. // Here, we're using one of the built-in references // qname = rmc:versions - rsp = sendRequest(new GetRequest(RMA_CUSTOM_REFS_DEFINITIONS_URL + "/" + CUSTOM_REF_VERSIONS.getLocalName()), expectedStatus); + rsp = sendRequest(new GetRequest(RMA_CUSTOM_REFS_DEFINITIONS_URL + "/" + "versions"), expectedStatus); jsonRsp = new JSONObject(new JSONTokener(rsp.getContentAsString())); @@ -597,7 +651,7 @@ public class RmRestApiTest extends BaseRMWebScriptTestCase implements RecordsMan } // Add a supersedes ref instance between them - final String supersedesRefLocalName = CUSTOM_REF_SUPERSEDES.getLocalName(); + final String supersedesRefLocalName = "supersedes"; String jsonString = new JSONStringer().object() .key("toNode").value(testRecord2.toString()) .key("refId").value(supersedesRefLocalName) diff --git a/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/util/BaseRMTestCase.java b/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/util/BaseRMTestCase.java index ab2da29b56..b7eedeb2ed 100644 --- a/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/util/BaseRMTestCase.java +++ b/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/util/BaseRMTestCase.java @@ -39,10 +39,8 @@ import org.alfresco.module.org_alfresco_module_rm.hold.HoldService; import org.alfresco.module.org_alfresco_module_rm.identifier.IdentifierService; import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; import org.alfresco.module.org_alfresco_module_rm.model.rma.type.RmSiteType; -import org.alfresco.module.org_alfresco_module_rm.record.InplaceRecordService; import org.alfresco.module.org_alfresco_module_rm.record.RecordService; import org.alfresco.module.org_alfresco_module_rm.recordfolder.RecordFolderService; -import org.alfresco.module.org_alfresco_module_rm.relationship.RelationshipService; import org.alfresco.module.org_alfresco_module_rm.report.ReportService; import org.alfresco.module.org_alfresco_module_rm.role.FilePlanRoleService; import org.alfresco.module.org_alfresco_module_rm.search.RecordsManagementSearchService; @@ -74,7 +72,6 @@ import org.alfresco.service.cmr.site.SiteInfo; import org.alfresco.service.cmr.site.SiteService; import org.alfresco.service.cmr.site.SiteVisibility; import org.alfresco.service.cmr.tagging.TaggingService; -import org.alfresco.service.cmr.version.VersionService; import org.alfresco.service.namespace.NamespaceService; import org.alfresco.service.namespace.QName; import org.alfresco.service.transaction.TransactionService; @@ -109,9 +106,6 @@ public abstract class BaseRMTestCase extends RetryingTransactionHelperTestCase protected QName ASPECT_CUSTOM_ASPECT = QName.createQName(URI, "customAspect"); protected QName ASPECT_RECORD_META_DATA = QName.createQName(URI, "recordMetaData"); - /** test data */ - protected String NAME_DM_DOCUMENT = "collabDocument.txt"; - /** admin user */ protected static final String ADMIN_USER = "admin"; @@ -136,7 +130,6 @@ public abstract class BaseRMTestCase extends RetryingTransactionHelperTestCase protected TaggingService taggingService; protected ActionService actionService; protected OwnableService ownableService; - protected VersionService versionService; /** RM Services */ protected DispositionService dispositionService; @@ -158,8 +151,6 @@ public abstract class BaseRMTestCase extends RetryingTransactionHelperTestCase protected RecordsManagementAuditService rmAuditService; protected IdentifierService identifierService; protected HoldService holdService; - protected InplaceRecordService inplaceRecordService; - protected RelationshipService relationshipService; /** test data */ protected String siteId; @@ -375,7 +366,6 @@ public abstract class BaseRMTestCase extends RetryingTransactionHelperTestCase taggingService = (TaggingService)applicationContext.getBean("TaggingService"); actionService = (ActionService)applicationContext.getBean("ActionService"); ownableService = (OwnableService)applicationContext.getBean("OwnableService"); - versionService = (VersionService)applicationContext.getBean("VersionService"); // Get RM services dispositionService = (DispositionService)applicationContext.getBean("DispositionService"); @@ -397,8 +387,6 @@ public abstract class BaseRMTestCase extends RetryingTransactionHelperTestCase rmAuditService = (RecordsManagementAuditService) applicationContext.getBean("RecordsManagementAuditService"); identifierService = (IdentifierService) applicationContext.getBean("recordsManagementIdentifierService"); holdService = (HoldService) applicationContext.getBean("HoldService"); - inplaceRecordService = (InplaceRecordService) applicationContext.getBean("InplaceRecordService"); - relationshipService = (RelationshipService) applicationContext.getBean("RelationshipService"); } /** @@ -442,6 +430,7 @@ public abstract class BaseRMTestCase extends RetryingTransactionHelperTestCase } if (folder != null && nodeService.exists(folder)) + { // Delete the folder nodeService.deleteNode(folder); @@ -745,7 +734,7 @@ public abstract class BaseRMTestCase extends RetryingTransactionHelperTestCase { // create collaboration site collabSiteId = GUID.generate(); - collaborationSite = siteService.createSite("site-dashboard", collabSiteId, "title", "description", SiteVisibility.PRIVATE); + collaborationSite = siteService.createSite("preset", collabSiteId, "title", "description", SiteVisibility.PRIVATE); documentLibrary = SiteServiceImpl.getSiteContainer( collabSiteId, SiteService.DOCUMENT_LIBRARY, @@ -758,7 +747,7 @@ public abstract class BaseRMTestCase extends RetryingTransactionHelperTestCase // create a folder and documents dmFolder = fileFolderService.create(documentLibrary, "collabFolder", ContentModel.TYPE_FOLDER).getNodeRef(); - dmDocument = fileFolderService.create(dmFolder, NAME_DM_DOCUMENT, ContentModel.TYPE_CONTENT).getNodeRef(); + dmDocument = fileFolderService.create(dmFolder, "collabDocument.txt", ContentModel.TYPE_CONTENT).getNodeRef(); dmConsumer = GUID.generate(); dmConsumerNodeRef = createPerson(dmConsumer); @@ -839,18 +828,10 @@ public abstract class BaseRMTestCase extends RetryingTransactionHelperTestCase */ protected abstract class BehaviourDrivenTest { - /** run in transaction */ protected boolean runInTransactionTests = true; - /** run as user */ - protected String runAsUser = AuthenticationUtil.getAdminUserName(); - - /** expected exception */ protected Class expectedException; - /** - * Default constructor - */ public BehaviourDrivenTest() { } @@ -860,24 +841,9 @@ public abstract class BaseRMTestCase extends RetryingTransactionHelperTestCase this.expectedException = expectedException; } - public BehaviourDrivenTest(Class expectedException, String runAsUser) - { - this.expectedException = expectedException; - this.runAsUser = runAsUser; - } - - public BehaviourDrivenTest(String runAsUser) - { - this.runAsUser = runAsUser; - } - - public BehaviourDrivenTest(String runAsUser, boolean runInTransactionTests) + public BehaviourDrivenTest(boolean runInTransactionTests) { this.runInTransactionTests = runInTransactionTests; - if (runAsUser != null) - { - this.runAsUser = runAsUser; - } } public void given() throws Exception { /** empty implementation */ } @@ -901,7 +867,7 @@ public abstract class BaseRMTestCase extends RetryingTransactionHelperTestCase { given(); } - }, runAsUser); + }); } else { @@ -919,7 +885,7 @@ public abstract class BaseRMTestCase extends RetryingTransactionHelperTestCase { when(); } - }, runAsUser); + }); doTestInTransaction(new VoidTest() { @@ -928,7 +894,7 @@ public abstract class BaseRMTestCase extends RetryingTransactionHelperTestCase { then(); } - }, runAsUser); + }); } else { @@ -945,7 +911,7 @@ public abstract class BaseRMTestCase extends RetryingTransactionHelperTestCase { when(); } - }, runAsUser); + }); } } finally @@ -959,7 +925,7 @@ public abstract class BaseRMTestCase extends RetryingTransactionHelperTestCase { after(); } - }, runAsUser); + }); } else { diff --git a/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/util/TestAction.java b/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/util/TestAction.java index e329ba5bed..3129ed58a9 100644 --- a/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/util/TestAction.java +++ b/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/util/TestAction.java @@ -35,7 +35,7 @@ public class TestAction extends RMActionExecuterAbstractBase { throw new RuntimeException("Unexpected parameter value. Expected " + PARAM_VALUE + " actual " + action.getParameterValue(PARAM)); } - this.getNodeService().addAspect(actionedUponNodeRef, ASPECT_RECORD, null); + this.nodeService.addAspect(actionedUponNodeRef, ASPECT_RECORD, null); } @Override diff --git a/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/util/TestActionPropertySubs.java b/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/util/TestActionPropertySubs.java index 3c4186ab3b..b806d33eaa 100644 --- a/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/util/TestActionPropertySubs.java +++ b/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/util/TestActionPropertySubs.java @@ -71,7 +71,7 @@ public class TestActionPropertySubs extends RMActionExecuterAbstractBase String yearShort = new SimpleDateFormat("yy").format(date); String yearLong = new SimpleDateFormat("yyyy").format(date); String yearWeek = new SimpleDateFormat("ww").format(date); - String name = (String) getNodeService().getProperty(actionedUponNodeRef, ContentModel.PROP_NAME); + String name = (String) nodeService.getProperty(actionedUponNodeRef, ContentModel.PROP_NAME); String company = I18NUtil.getMessage("test.company"); assertEquals(dayShort, (String) action.getParameterValue("dayShort")); diff --git a/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/util/TestModel.java b/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/util/TestModel.java deleted file mode 100644 index 31b2690545..0000000000 --- a/rm-server/test/java/org/alfresco/module/org_alfresco_module_rm/test/util/TestModel.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright (C) 2005-2014 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - */ -package org.alfresco.module.org_alfresco_module_rm.test.util; - -import org.alfresco.service.namespace.QName; - -/** - * @author Roy Wetherall - * @since 2.3 - */ -public interface TestModel -{ - public static final String TEST_URI = "http://www.alfresco.org/model/rmtest/1.0"; - public static final String TEST_PREFIX = "rmt"; - - public static final QName ASPECT_RECORD_METADATA = QName.createQName(TEST_URI, "recordMetaData"); - public static final QName PROPERTY_RECORD_METADATA = QName.createQName(TEST_URI, "recordMetaDataProperty"); -} diff --git a/rm-server/test/resources/test-context.xml b/rm-server/test/resources/test-context.xml index f5e35faf58..a5396c0b50 100644 --- a/rm-server/test/resources/test-context.xml +++ b/rm-server/test/resources/test-context.xml @@ -70,7 +70,7 @@ - + @@ -84,7 +84,7 @@ - + @@ -105,7 +105,7 @@ - + @@ -127,12 +127,27 @@ - + + + + + + + + + + + + + - - - - + + + + ${spaces.store} + ${spaces.archive.store} + + @@ -174,11 +189,11 @@ - + - + - + org.alfresco.module.org_alfresco_module_rm.test.util.TestService @@ -208,7 +223,7 @@ - + @@ -217,21 +232,12 @@ - - - - false - - - Search - - - buildonly - - - - manager - - - + + + + + + + + \ No newline at end of file diff --git a/rm-server/test/resources/test-model.xml b/rm-server/test/resources/test-model.xml index 2f7b137c3a..c35643dd3b 100644 --- a/rm-server/test/resources/test-model.xml +++ b/rm-server/test/resources/test-model.xml @@ -47,12 +47,16 @@ - + + + + - - d:text - - + + d:text + true + + diff --git a/rm-server/tomcat/context.xml b/rm-server/tomcat/context.xml deleted file mode 100644 index 73015268e2..0000000000 --- a/rm-server/tomcat/context.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - - - \ No newline at end of file diff --git a/rm-server/unit-test/java/org/alfresco/module/org_alfresco_module_rm/action/BaseActionUnitTest.java b/rm-server/unit-test/java/org/alfresco/module/org_alfresco_module_rm/action/BaseActionUnitTest.java deleted file mode 100644 index 3a6207aa7b..0000000000 --- a/rm-server/unit-test/java/org/alfresco/module/org_alfresco_module_rm/action/BaseActionUnitTest.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright (C) 2005-2014 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - */ -package org.alfresco.module.org_alfresco_module_rm.action; - -import static org.mockito.Mockito.doReturn; - -import org.alfresco.module.org_alfresco_module_rm.test.util.BaseUnitTest; -import org.alfresco.service.cmr.action.Action; -import org.mockito.Mock; - -/** - * Declare as version record action unit test. - * - * @author Roy Wetherall - * @since 2.3 - */ -public abstract class BaseActionUnitTest extends BaseUnitTest -{ - /** mocked action */ - private @Mock Action mockedAction; - - /** - * @return mocked action - */ - protected Action getMockedAction() - { - return mockedAction; - } - - /** - * Helper to mock an action parameter value - */ - protected void mockActionParameterValue(String name, Object value) - { - doReturn(value).when(mockedAction).getParameterValue(name); - } - -} diff --git a/rm-server/unit-test/java/org/alfresco/module/org_alfresco_module_rm/action/dm/DeclareAsVersionRecordActionUnitTest.java b/rm-server/unit-test/java/org/alfresco/module/org_alfresco_module_rm/action/dm/DeclareAsVersionRecordActionUnitTest.java deleted file mode 100644 index b66367cf6d..0000000000 --- a/rm-server/unit-test/java/org/alfresco/module/org_alfresco_module_rm/action/dm/DeclareAsVersionRecordActionUnitTest.java +++ /dev/null @@ -1,293 +0,0 @@ -/* - * Copyright (C) 2005-2014 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - */ -package org.alfresco.module.org_alfresco_module_rm.action.dm; - -import static org.mockito.Matchers.any; -import static org.mockito.Matchers.eq; -import static org.mockito.Mockito.doReturn; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.never; -import static org.mockito.Mockito.times; -import static org.mockito.Mockito.verify; - -import org.alfresco.error.AlfrescoRuntimeException; -import org.alfresco.model.ContentModel; -import org.alfresco.module.org_alfresco_module_rm.action.BaseActionUnitTest; -import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService; -import org.alfresco.service.cmr.action.Action; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.namespace.QName; -import org.junit.Test; -import org.mockito.InjectMocks; - -/** - * Declare as version record action unit test. - * - * @author Roy Wetherall - * @since 2.3 - */ -public class DeclareAsVersionRecordActionUnitTest extends BaseActionUnitTest -{ - /** Sync Model */ - private static final String SYNC_MODEL_1_0_URI = "http://www.alfresco.org/model/sync/1.0"; - private static final QName ASPECT_SYNCED = QName.createQName(SYNC_MODEL_1_0_URI, "synced"); - - /** actioned upon node reference */ - private NodeRef actionedUponNodeRef; - - /** declare as version record action */ - private @InjectMocks DeclareAsVersionRecordAction declareAsVersionRecordAction; - - /** - * @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseUnitTest#before() - */ - @Override - public void before() throws Exception - { - super.before(); - - // mocked action - declareAsVersionRecordAction.setAuditable(false); - - // mocked actioned upon noderef - actionedUponNodeRef = generateNodeRef(); - } - - /** - * Given that the actioned upon node reference doesn't exist - * When I execute the action - * Then nothing happens - */ - @Test - public void actionedUponNodeRefDoesntExist() - { - doReturn(false).when(mockedNodeService).exists(actionedUponNodeRef); - declareAsVersionRecordAction.executeImpl(mock(Action.class), actionedUponNodeRef); - verify(mockedRecordableVersionService, never()).createRecordFromLatestVersion(filePlan, actionedUponNodeRef); - } - - /** - * Given that the actioned upon node reference isn't a subtype of cm:content - * When I execute the action - * Then nothing happens - */ - @Test - public void aciontedUponNodeRefIsntSubTypeOfCmContent() - { - doReturn(true).when(mockedNodeService).exists(actionedUponNodeRef); - doReturn(false).when(mockedDictionaryService).isSubClass(any(QName.class), eq(ContentModel.TYPE_CONTENT)); - declareAsVersionRecordAction.executeImpl(mock(Action.class), actionedUponNodeRef); - verify(mockedRecordableVersionService, never()).createRecordFromLatestVersion(filePlan, actionedUponNodeRef); - } - - /** - * Given that the actioned upon node reference doesn't have the versionable aspect applied - * When I executed the action - * Then nothing happens - */ - @Test - public void actionedUponNodeRefDoesntHaveVersionableApplied() - { - doReturn(true).when(mockedNodeService).exists(actionedUponNodeRef); - doReturn(true).when(mockedDictionaryService).isSubClass(any(QName.class), eq(ContentModel.TYPE_CONTENT)); - doReturn(false).when(mockedNodeService).hasAspect(actionedUponNodeRef, ContentModel.ASPECT_VERSIONABLE); - declareAsVersionRecordAction.executeImpl(mock(Action.class), actionedUponNodeRef); - verify(mockedRecordableVersionService, never()).createRecordFromLatestVersion(filePlan, actionedUponNodeRef); - } - - /** - * Given that the actioned upon node reference is already an record - * When I execute the action - * Then nothing happens - */ - @Test - public void actionedUponNodeRefAlreadyRecord() - { - 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(true).when(mockedNodeService).hasAspect(actionedUponNodeRef, ASPECT_RECORD); - declareAsVersionRecordAction.executeImpl(mock(Action.class), actionedUponNodeRef); - verify(mockedRecordableVersionService, never()).createRecordFromLatestVersion(filePlan, actionedUponNodeRef); - } - - /** - * Given that the actioned upon node reference is a working copy - * When I execute the action - * Then nothing happens - */ - @Test - public void actionedUponNodeRefWorkingCopy() - { - 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(true).when(mockedNodeService).hasAspect(actionedUponNodeRef, ContentModel.ASPECT_WORKING_COPY); - declareAsVersionRecordAction.executeImpl(mock(Action.class), actionedUponNodeRef); - verify(mockedRecordableVersionService, never()).createRecordFromLatestVersion(filePlan, actionedUponNodeRef); - } - - /** - * Given that the actioned upon node reference is a rejected record - * When I execute the action - * Then nothing happens - */ - @Test - public void actionedUponNodeRefRejectedRecord() - { - 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(true).when(mockedNodeService).hasAspect(actionedUponNodeRef, ASPECT_RECORD_REJECTION_DETAILS); - declareAsVersionRecordAction.executeImpl(mock(Action.class), actionedUponNodeRef); - verify(mockedRecordableVersionService, never()).createRecordFromLatestVersion(filePlan, actionedUponNodeRef); - } - - /** - * Given that the actioned upon node reference is synced to the cloud - * When I execute the action - * Then nothing happens - */ - @Test - public void actionedUponNodeRefSynced() - { - 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(true).when(mockedNodeService).hasAspect(actionedUponNodeRef, ASPECT_SYNCED); - declareAsVersionRecordAction.executeImpl(mock(Action.class), actionedUponNodeRef); - verify(mockedRecordableVersionService, never()).createRecordFromLatestVersion(filePlan, actionedUponNodeRef); - } - - /** - * Given that no file plan is provided - * And no default file plan exists - * When I execute the action - * Then an exception is thrown - */ - @Test - public void noFilePlanParameterNoDefaultFilePlan() - { - // setup - 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); - - // no default file plan - doReturn(null).when(mockedFilePlanService).getFilePlanBySiteId(FilePlanService.DEFAULT_RM_SITE_ID); - - // expect exception - exception.expect(AlfrescoRuntimeException.class); - - // exceute action - declareAsVersionRecordAction.executeImpl(mock(Action.class), actionedUponNodeRef); - } - - /** - * Given that no file plan is provided - * And adefault file plan exists - * When I execute the action - * Then a version record is declared - */ - @Test - public void noFilePlanParameterDefaultFilePlan() - { - // setup - 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); - - // no default file plan - doReturn(filePlan).when(mockedFilePlanService).getFilePlanBySiteId(FilePlanService.DEFAULT_RM_SITE_ID); - - // exceute action - declareAsVersionRecordAction.executeImpl(mock(Action.class), actionedUponNodeRef); - verify(mockedRecordableVersionService, times(1)).createRecordFromLatestVersion(filePlan, actionedUponNodeRef); - } - - /** - * Given that a file plan is provided - * And it isn't a file plan - * When I execute the action - * Then an exception is thrown - */ - @Test - public void invalidFilePlanParameter() - { - // setup - 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); - - // not a file plan is provided in the parameters - mockActionParameterValue(DeclareAsVersionRecordAction.PARAM_FILE_PLAN, generateNodeRef()); - - // expect exception - exception.expect(AlfrescoRuntimeException.class); - - // exceute action - declareAsVersionRecordAction.executeImpl(getMockedAction(), actionedUponNodeRef); - } - - /** - * Given that a file plan is provided - * And it is a file plan - * When I execute the action - * Then a version record is declared - */ - @Test - public void validFilePlanParameter() - { - // setup - 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); - - // not a file plan is provided in the parameters - NodeRef myFilePlan = generateNodeRef(TYPE_FILE_PLAN); - doReturn(true).when(mockedFilePlanService).isFilePlan(myFilePlan); - mockActionParameterValue(DeclareAsVersionRecordAction.PARAM_FILE_PLAN, myFilePlan); - - // exceute action - declareAsVersionRecordAction.executeImpl(getMockedAction(), actionedUponNodeRef); - verify(mockedRecordableVersionService, times(1)).createRecordFromLatestVersion(myFilePlan, actionedUponNodeRef); - } -} diff --git a/rm-server/unit-test/java/org/alfresco/module/org_alfresco_module_rm/action/impl/FileReportActionUnitTest.java b/rm-server/unit-test/java/org/alfresco/module/org_alfresco_module_rm/action/impl/FileReportActionUnitTest.java index a3cbd6bc97..5da2c6697f 100644 --- a/rm-server/unit-test/java/org/alfresco/module/org_alfresco_module_rm/action/impl/FileReportActionUnitTest.java +++ b/rm-server/unit-test/java/org/alfresco/module/org_alfresco_module_rm/action/impl/FileReportActionUnitTest.java @@ -18,14 +18,17 @@ */ package org.alfresco.module.org_alfresco_module_rm.action.impl; +import static org.mockito.Mockito.doReturn; import static org.mockito.Mockito.verifyZeroInteractions; import org.alfresco.error.AlfrescoRuntimeException; -import org.alfresco.module.org_alfresco_module_rm.action.BaseActionUnitTest; +import org.alfresco.module.org_alfresco_module_rm.test.util.BaseUnitTest; import org.alfresco.repo.content.MimetypeMap; +import org.alfresco.service.cmr.action.Action; import org.alfresco.service.cmr.repository.NodeRef; import org.junit.Test; import org.mockito.InjectMocks; +import org.mockito.Mock; /** * Unit test for file report action. @@ -33,11 +36,14 @@ import org.mockito.InjectMocks; * @author Roy Wetherall * @since 2.2 */ -public class FileReportActionUnitTest extends BaseActionUnitTest +public class FileReportActionUnitTest extends BaseUnitTest { /** actioned upon node reference */ private NodeRef actionedUponNodeRef; + /** mocked action */ + private @Mock Action mockedAction; + /** file report action */ private @InjectMocks FileReportAction fileReportAction; @@ -45,7 +51,7 @@ public class FileReportActionUnitTest extends BaseActionUnitTest * @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseUnitTest#before() */ @Override - public void before() throws Exception + public void before() { super.before(); @@ -56,6 +62,14 @@ public class FileReportActionUnitTest extends BaseActionUnitTest fileReportAction.setAuditable(false); } + /** + * Helper to mock an action parameter value + */ + private void mockActionParameterValue(String name, String value) + { + doReturn(value).when(mockedAction).getParameterValue(name); + } + /** * given the destination is not set, ensure that an exception is thrown */ @@ -74,7 +88,7 @@ public class FileReportActionUnitTest extends BaseActionUnitTest // == when == // execute action - fileReportAction.executeImpl(getMockedAction(), actionedUponNodeRef); + fileReportAction.executeImpl(mockedAction, actionedUponNodeRef); // == then == verifyZeroInteractions(mockedReportService, mockedNodeService); @@ -98,7 +112,7 @@ public class FileReportActionUnitTest extends BaseActionUnitTest // == when == // execute action - fileReportAction.executeImpl(getMockedAction(), actionedUponNodeRef); + fileReportAction.executeImpl(mockedAction, actionedUponNodeRef); // == then == verifyZeroInteractions(mockedReportService, mockedNodeService); diff --git a/rm-server/unit-test/java/org/alfresco/module/org_alfresco_module_rm/action/impl/UnlinkFromActionUnitTest.java b/rm-server/unit-test/java/org/alfresco/module/org_alfresco_module_rm/action/impl/UnlinkFromActionUnitTest.java deleted file mode 100644 index 312bcda9f3..0000000000 --- a/rm-server/unit-test/java/org/alfresco/module/org_alfresco_module_rm/action/impl/UnlinkFromActionUnitTest.java +++ /dev/null @@ -1,143 +0,0 @@ -/* - * Copyright (C) 2005-2014 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - */ -package org.alfresco.module.org_alfresco_module_rm.action.impl; - -import static org.mockito.Matchers.any; -import static org.mockito.Mockito.doReturn; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.never; -import static org.mockito.Mockito.times; -import static org.mockito.Mockito.verify; - -import org.alfresco.error.AlfrescoRuntimeException; -import org.alfresco.module.org_alfresco_module_rm.action.BaseActionUnitTest; -import org.alfresco.service.cmr.action.Action; -import org.alfresco.service.cmr.repository.NodeRef; -import org.junit.Before; -import org.junit.Test; -import org.mockito.InjectMocks; - -/** - * Unit test for unlink from action - * - * @author Roy Wetherall - * @since 2.3 - */ -public class UnlinkFromActionUnitTest extends BaseActionUnitTest -{ - private NodeRef record; - private NodeRef recordFolder; - - @InjectMocks - private UnlinkFromAction action; - - @Before - @Override - public void before() throws Exception - { - super.before(); - - record = generateRecord(); - recordFolder = generateRecordFolder(); - } - - /** - * Given the actioned upon node does not exist - * When the action is executed - * Then nothing happens - */ - @Test - public void nodeDoesNotExist() - { - doReturn(false).when(mockedNodeService).exists(record); - action.executeImpl(mock(Action.class), record); - verify(mockedRecordService, never()).unlink(any(NodeRef.class), any(NodeRef.class)); - } - - /** - * Given the actioned upon node is pending delete - * When the action is executed - * Then nothing happens - */ - @Test - public void nodePendingDelete() - { - doReturn(true).when(mockedNodeService).exists(record); - doReturn(true).when(mockedNodeService).hasAspect(record, ASPECT_PENDING_DELETE); - action.executeImpl(mock(Action.class), record); - verify(mockedRecordService, never()).unlink(any(NodeRef.class), any(NodeRef.class)); - } - - /** - * Given that actioned upon node is not a record - * When the action is executed - * Then nothing happens - */ - @Test - public void nodeNotRecord() - { - NodeRef notRecord = generateCmContent(generateText()); - doReturn(true).when(mockedNodeService).exists(notRecord); - doReturn(false).when(mockedNodeService).hasAspect(notRecord, ASPECT_PENDING_DELETE); - action.executeImpl(mock(Action.class), notRecord); - verify(mockedRecordService, never()).unlink(any(NodeRef.class), any(NodeRef.class)); - } - - /** - * Given that the record folder parameter is not provided - * When the action is executed - * Then an exception is thrown - */ - @Test(expected=AlfrescoRuntimeException.class) - public void recordFolderParamMissing() - { - // setup record - doReturn(true).when(mockedNodeService).exists(record); - doReturn(false).when(mockedNodeService).hasAspect(record, ASPECT_PENDING_DELETE); - - // create action mock - mockActionParameterValue(UnlinkFromAction.PARAM_RECORD_FOLDER, null); - - // execute action - action.executeImpl(getMockedAction(), record); - } - - /** - * Given that a valid record folder is provided - * When the action is executed - * Then the record is unlinked from the record folder - */ - @Test - public void validUnlink() - { - // setup record - doReturn(true).when(mockedNodeService).exists(record); - doReturn(false).when(mockedNodeService).hasAspect(record, ASPECT_PENDING_DELETE); - - // create action mock - mockActionParameterValue(UnlinkFromAction.PARAM_RECORD_FOLDER, recordFolder.toString()); - - // execute action - action.executeImpl(getMockedAction(), record); - - // verify unlink - verify(mockedRecordService, times(1)).unlink(record, recordFolder); - } - -} diff --git a/rm-server/unit-test/java/org/alfresco/module/org_alfresco_module_rm/bootstrap/BootstrapImporterModuleComponentUnitTest.java b/rm-server/unit-test/java/org/alfresco/module/org_alfresco_module_rm/bootstrap/BootstrapImporterModuleComponentUnitTest.java deleted file mode 100644 index 102304dd1e..0000000000 --- a/rm-server/unit-test/java/org/alfresco/module/org_alfresco_module_rm/bootstrap/BootstrapImporterModuleComponentUnitTest.java +++ /dev/null @@ -1,94 +0,0 @@ -/* - * Copyright (C) 2005-2014 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - */ -package org.alfresco.module.org_alfresco_module_rm.bootstrap; - -import static org.mockito.Mockito.doReturn; -import static org.mockito.Mockito.never; -import static org.mockito.Mockito.times; -import static org.mockito.Mockito.verify; - -import org.alfresco.module.org_alfresco_module_rm.patch.ModulePatchExecuter; -import org.alfresco.module.org_alfresco_module_rm.test.util.BaseUnitTest; -import org.alfresco.repo.importer.ImporterBootstrap; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.repository.StoreRef; -import org.junit.Test; -import org.mockito.InjectMocks; -import org.mockito.Mock; - -/** - * Bootstrap importer module component unit test - * - * @author Roy Wetherall - * @since 2.3 - */ -public class BootstrapImporterModuleComponentUnitTest extends BaseUnitTest -{ - /** RM config node */ - private static final NodeRef configNodeRef = new NodeRef(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE, "rm_config_folder"); - - /** mocks */ - @Mock(name="importer") private ImporterBootstrap mockedImporter; - @Mock(name="modulePatchExecuter") private ModulePatchExecuter mockedModulePatchExecuter; - @Mock(name="recordContributorsGroupBootstrapComponent") private RecordContributorsGroupBootstrapComponent mockedRecordContributorsGroupBootstrapComponent; - - /** importer */ - @InjectMocks - private BootstrapImporterModuleComponent importer; - - /** - * Given that the system has already been bootstraped - * When I try and boostrap the system - * Then the system is not bootstraped again - */ - @Test - public void alreadyBootstraped() throws Throwable - { - // config node exists - doReturn(true).when(mockedNodeService).exists(configNodeRef); - - // boostrap - importer.executeInternal(); - - // not bootstraped - verify(mockedImporter, never()).bootstrap(); - verify(mockedModulePatchExecuter, never()).initSchemaVersion(); - verify(mockedRecordContributorsGroupBootstrapComponent, never()).createRecordContributorsGroup(); - } - - /** - * Given that the system has not been bootstraped - * When I try and bootstrap the system - * Then the system is bootstraped - */ - @Test - public void boostrap() throws Throwable - { - // config node does not exist - doReturn(false).when(mockedNodeService).exists(configNodeRef); - - // boostrap - importer.executeInternal(); - - // not bootstraped - verify(mockedImporter, times(1)).bootstrap(); - verify(mockedModulePatchExecuter, times(1)).initSchemaVersion(); - verify(mockedRecordContributorsGroupBootstrapComponent, times(1)).createRecordContributorsGroup(); - } -} diff --git a/rm-server/unit-test/java/org/alfresco/module/org_alfresco_module_rm/bootstrap/RecordContributorsGroupBootstrapComponentUnitTest.java b/rm-server/unit-test/java/org/alfresco/module/org_alfresco_module_rm/bootstrap/RecordContributorsGroupBootstrapComponentUnitTest.java deleted file mode 100644 index 48f1d3315c..0000000000 --- a/rm-server/unit-test/java/org/alfresco/module/org_alfresco_module_rm/bootstrap/RecordContributorsGroupBootstrapComponentUnitTest.java +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Copyright (C) 2005-2014 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - */ -package org.alfresco.module.org_alfresco_module_rm.bootstrap; - -import static org.mockito.Mockito.doReturn; -import static org.mockito.Mockito.times; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.verifyNoMoreInteractions; - -import org.alfresco.module.org_alfresco_module_rm.test.util.BaseUnitTest; -import org.alfresco.service.cmr.security.AuthorityType; -import org.junit.Test; -import org.mockito.InjectMocks; - -/** - * Record contributors group bootstrap component unit test - * - * @author Roy Wetherall - * @since 2.3 - */ -public class RecordContributorsGroupBootstrapComponentUnitTest extends BaseUnitTest -{ - @InjectMocks - private RecordContributorsGroupBootstrapComponent component; - - /** - * Given that the record contributors group already exists - * When I try and create the group - * Then nothing happens - */ - @Test - public void groupAlreadyExists() - { - // group already exists - doReturn(true).when(mockedAuthorityService).authorityExists(RecordContributorsGroupBootstrapComponent.GROUP_RECORD_CONTRIBUTORS); - - // create group - component.createRecordContributorsGroup(); - - // group not created - verify(mockedAuthorityService, times(1)).authorityExists(RecordContributorsGroupBootstrapComponent.GROUP_RECORD_CONTRIBUTORS); - verifyNoMoreInteractions(mockedAuthorityService); - } - - /** - * Given that the record contributors group does not exist - * When I try and create the group - * Then the group is successfully created - * And 'everyone' is added to the new group - */ - @Test - public void createGroup() - { - // group does not exists - doReturn(false).when(mockedAuthorityService).authorityExists(RecordContributorsGroupBootstrapComponent.GROUP_RECORD_CONTRIBUTORS); - - // create group - component.createRecordContributorsGroup(); - - // group not created - verify(mockedAuthorityService, times(1)).createAuthority(AuthorityType.GROUP, RecordContributorsGroupBootstrapComponent.RECORD_CONTRIBUTORS); - verify(mockedAuthorityService, times(1)).addAuthority(RecordContributorsGroupBootstrapComponent.GROUP_RECORD_CONTRIBUTORS, "admin"); - verify(mockedAuthorityService, times(1)).authorityExists(RecordContributorsGroupBootstrapComponent.GROUP_RECORD_CONTRIBUTORS); - verifyNoMoreInteractions(mockedAuthorityService); - } - -} diff --git a/rm-server/unit-test/java/org/alfresco/module/org_alfresco_module_rm/capability/RMEntryVoterUnitTest.java b/rm-server/unit-test/java/org/alfresco/module/org_alfresco_module_rm/capability/RMEntryVoterUnitTest.java deleted file mode 100644 index 461ddd3289..0000000000 --- a/rm-server/unit-test/java/org/alfresco/module/org_alfresco_module_rm/capability/RMEntryVoterUnitTest.java +++ /dev/null @@ -1,220 +0,0 @@ -/* - * Copyright (C) 2005-2014 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - */ -package org.alfresco.module.org_alfresco_module_rm.capability; - -import static org.mockito.Matchers.any; -import static org.mockito.Matchers.eq; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.times; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; -import static org.junit.Assert.*; - -import java.lang.reflect.Method; -import java.util.Iterator; - -import net.sf.acegisecurity.Authentication; -import net.sf.acegisecurity.ConfigAttribute; -import net.sf.acegisecurity.vote.AccessDecisionVoter; - -import org.alfresco.error.AlfrescoRuntimeException; -import org.alfresco.module.org_alfresco_module_rm.capability.policy.ConfigAttributeDefinition; -import org.alfresco.module.org_alfresco_module_rm.capability.policy.Policy; -import org.alfresco.module.org_alfresco_module_rm.test.util.BaseUnitTest; -import org.alfresco.service.cmr.repository.NodeRef; -import org.aopalliance.intercept.MethodInvocation; -import org.junit.Before; -import org.junit.Test; -import org.mockito.InjectMocks; -import org.mockito.Mock; - -/** - * RM entry voter unit test - * - * @author Roy Wetherall - * @since 2.3 - */ -public class RMEntryVoterUnitTest extends BaseUnitTest -{ - private static final String POLICY_NAME = "myPolicy"; - - /** RM Entry */ - private @InjectMocks RMEntryVoter entryVoter; - - /** mocked policy */ - private @Mock Policy mockedPolicy; - - /** mocked authentication */ - private @Mock Authentication mockedAuthentication; - - /** - * @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseUnitTest#before() - */ - @Before - @Override - public void before() throws Exception - { - super.before(); - - // don't run as system - when(mockedAuthenticationUtil.isRunAsUserTheSystemUser()) - .thenReturn(false); - - // indicate that "vote" transaction value is not set - when(mockedTransactionalResourceHelper.isResourcePresent("voting")) - .thenReturn(false); - } - - /** - * Given that the system is already voting - * When I vote - * Then access granted - */ - @Test - public void alreadyVoting() throws Exception - { - // indicate already voting - when(mockedTransactionalResourceHelper.isResourcePresent("voting")) - .thenReturn(true); - - // given I am providing an invalid policy for a method - MethodInvocation mockedMethodInvocation = createMethodInvoation("myTestMethod", NodeRef.class); - net.sf.acegisecurity.ConfigAttributeDefinition mockedConfigDef = createConfigDefinition("RM.invalid"); - - // call vote - assertEquals( - AccessDecisionVoter.ACCESS_GRANTED, - entryVoter.vote(mockedAuthentication, mockedMethodInvocation, mockedConfigDef)); - } - - /** - * Given that I am running this as the system user - * When I evaluate - * Then access granted - */ - @Test - public void runAsSystem() throws Exception - { - // run as system - when(mockedAuthenticationUtil.isRunAsUserTheSystemUser()) - .thenReturn(true); - - // given I am providing an invalid policy for a method - MethodInvocation mockedMethodInvocation = createMethodInvoation("myTestMethod", NodeRef.class); - net.sf.acegisecurity.ConfigAttributeDefinition mockedConfigDef = createConfigDefinition("RM.invalid"); - - // call vote - assertEquals( - AccessDecisionVoter.ACCESS_GRANTED, - entryVoter.vote(mockedAuthentication, mockedMethodInvocation, mockedConfigDef)); - } - - /** - * Given that we have provided an invalid policy - * When I evaluate the voter - * Then an AlfrescoRuntimeException is thrown - */ - @Test - public void invalidPolicy() throws Exception - { - // given I am providing an invalid policy for a method - MethodInvocation mockedMethodInvocation = createMethodInvoation("myTestMethod", NodeRef.class); - net.sf.acegisecurity.ConfigAttributeDefinition mockedConfigDef = createConfigDefinition("RM.invalid"); - - // I expect an Alfresco Runtime Exception - exception.expect(AlfrescoRuntimeException.class); - - // call vote - entryVoter.vote(mockedAuthentication, mockedMethodInvocation, mockedConfigDef); - } - - /** - * Given that I have provided a valid policy - * When I evaluate the voter - * Then the corresponding policy will be evaluated - */ - @Test - public void validPolicy() throws Exception - { - // valid policy - when(mockedPolicy.getName()) - .thenReturn(POLICY_NAME); - entryVoter.registerPolicy(mockedPolicy); - - // mock calling details - MethodInvocation mockedMethodInvocation = createMethodInvoation("myTestMethod", NodeRef.class); - net.sf.acegisecurity.ConfigAttributeDefinition mockedConfigDef = createConfigDefinition("RM." + POLICY_NAME); - - // call vote - entryVoter.vote(mockedAuthentication, mockedMethodInvocation, mockedConfigDef); - - // verify that the policy was executed - verify(mockedPolicy, times(1)).evaluate(eq(mockedMethodInvocation), any(Class[].class), any(ConfigAttributeDefinition.class)); - } - - /** - * Helper method to create configuration object - */ - @SuppressWarnings("rawtypes") - private net.sf.acegisecurity.ConfigAttributeDefinition createConfigDefinition(String value) - { - net.sf.acegisecurity.ConfigAttributeDefinition mockedConfig = mock(net.sf.acegisecurity.ConfigAttributeDefinition.class); - - ConfigAttribute mockedConfigAttr = mock(ConfigAttribute.class); - when(mockedConfigAttr.getAttribute()) - .thenReturn(value); - - Iterator mockedIter = mock(Iterator.class); - when(mockedIter.hasNext()) - .thenReturn(true) - .thenReturn(false); - when(mockedIter.next()) - .thenReturn(mockedConfigAttr); - - when(mockedConfig.getConfigAttributes()) - .thenReturn(mockedIter); - - return mockedConfig; - } - - /** - * Helper method to create method invocation mock - */ - private MethodInvocation createMethodInvoation(String methodName, Class ... parameterTypes) - throws Exception - { - // mock method invocation - MethodInvocation mockedMethodInvocation = mock(MethodInvocation.class); - - // get method object .. assumed to be a method on this object - Method method = RMEntryVoterUnitTest.class.getMethod(methodName, parameterTypes); - when(mockedMethodInvocation.getMethod()) - .thenReturn(method); - - return mockedMethodInvocation; - } - - /** ========= Test methods ======== */ - - public void myTestMethod(NodeRef nodeRef) - { - // does nothing - } - -} diff --git a/rm-server/unit-test/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/CapabilityDeclarativeConditionSuite.java b/rm-server/unit-test/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/CapabilityDeclarativeConditionSuite.java deleted file mode 100644 index b27a9ba6b3..0000000000 --- a/rm-server/unit-test/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/CapabilityDeclarativeConditionSuite.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright (C) 2005-2014 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - */ -package org.alfresco.module.org_alfresco_module_rm.capability.declarative.condition; - -import org.junit.runner.RunWith; -import org.junit.runners.Suite; -import org.junit.runners.Suite.SuiteClasses; - -/** - * capability.declarative.condition unit test suite - * - * @author Roy Wetherall - * @since 2.3 - */ -@RunWith(Suite.class) -@SuiteClasses( -{ - HoldCapabilityConditionUnitTest.class, - FillingOnHoldContainerCapabilityConditionUnitTest.class, - FrozenCapabilityConditionUnitTest.class -}) -public class CapabilityDeclarativeConditionSuite -{ -} diff --git a/rm-server/unit-test/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/FillingOnHoldContainerCapabilityConditionUnitTest.java b/rm-server/unit-test/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/FillingOnHoldContainerCapabilityConditionUnitTest.java deleted file mode 100644 index 6fb7262306..0000000000 --- a/rm-server/unit-test/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/FillingOnHoldContainerCapabilityConditionUnitTest.java +++ /dev/null @@ -1,141 +0,0 @@ -/* - * Copyright (C) 2005-2014 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - */ -package org.alfresco.module.org_alfresco_module_rm.capability.declarative.condition; - -import static org.mockito.Mockito.*; -import static org.junit.Assert.*; - -import org.alfresco.module.org_alfresco_module_rm.capability.RMPermissionModel; -import org.alfresco.module.org_alfresco_module_rm.test.util.BaseUnitTest; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.security.AccessStatus; -import org.junit.Before; -import org.junit.Test; -import org.mockito.InjectMocks; - -/** - * Filling on hold container capability condition unit test - * - * @author Roy Wetherall - * @since 2.3 - */ -public class FillingOnHoldContainerCapabilityConditionUnitTest extends BaseUnitTest -{ - /** evaluator */ - private @InjectMocks FillingOnHoldContainerCapabilityCondition condition; - - /** - * @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseUnitTest#before() - */ - @Before - @Override - public void before() throws Exception - { - super.before(); - } - - /** - * Given hold container node - * And no filling permission - * When evaluate - * Then false - */ - @Test - public void noFillingOnHoldContainer() - { - NodeRef holdContainer = generateNodeRef(TYPE_HOLD_CONTAINER); - when(mockedFilePlanService.isFilePlan(holdContainer)) - .thenReturn(false); - when(mockedPermissionService.hasPermission(holdContainer, RMPermissionModel.FILE_RECORDS)) - .thenReturn(AccessStatus.DENIED); - - assertFalse(condition.evaluateImpl(holdContainer)); - } - - /** - * Given hold container node - * And filling permission - * When evaluate - * Then true - */ - @Test - public void fillingOnHoldContainer() - { - NodeRef holdContainer = generateNodeRef(TYPE_HOLD_CONTAINER); - when(mockedFilePlanService.isFilePlan(holdContainer)) - .thenReturn(false); - when(mockedPermissionService.hasPermission(holdContainer, RMPermissionModel.FILE_RECORDS)) - .thenReturn(AccessStatus.ALLOWED); - - assertTrue(condition.evaluateImpl(holdContainer)); - } - - /** - * Given file-plan node - * And no filling permission on hold container - * When evaluate - * Then false - */ - @Test - public void filePlanNoFilling() - { - NodeRef holdContainer = generateNodeRef(TYPE_HOLD_CONTAINER); - when(mockedFilePlanService.getHoldContainer(filePlan)) - .thenReturn(holdContainer); - when(mockedPermissionService.hasPermission(holdContainer, RMPermissionModel.FILE_RECORDS)) - .thenReturn(AccessStatus.DENIED); - - assertFalse(condition.evaluateImpl(holdContainer)); - } - - /** - * Given file-plan node - * And filling permission on hold container - * When evaluate - * Then true - */ - @Test - public void filePlanFilling() - { - NodeRef holdContainer = generateNodeRef(TYPE_HOLD_CONTAINER); - when(mockedFilePlanService.getHoldContainer(filePlan)) - .thenReturn(holdContainer); - when(mockedPermissionService.hasPermission(holdContainer, RMPermissionModel.FILE_RECORDS)) - .thenReturn(AccessStatus.ALLOWED); - - assertTrue(condition.evaluateImpl(holdContainer)); - } - - /** - * Given unexpected node type - * When evaluate - * Then false - */ - @Test - public void unexpectedNode() - { - NodeRef unexpectedNode = generateNodeRef(); - when(mockedFilePlanService.isFilePlan(unexpectedNode)) - .thenReturn(false); - when(mockedPermissionService.hasPermission(unexpectedNode, RMPermissionModel.FILE_RECORDS)) - .thenReturn(AccessStatus.ALLOWED); - - assertFalse(condition.evaluateImpl(unexpectedNode)); - } -} diff --git a/rm-server/unit-test/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/FrozenCapabilityConditionUnitTest.java b/rm-server/unit-test/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/FrozenCapabilityConditionUnitTest.java deleted file mode 100644 index 55f10e24c5..0000000000 --- a/rm-server/unit-test/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/FrozenCapabilityConditionUnitTest.java +++ /dev/null @@ -1,232 +0,0 @@ -/* - * Copyright (C) 2005-2014 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - */ -package org.alfresco.module.org_alfresco_module_rm.capability.declarative.condition; - -import static org.junit.Assert.*; -import static org.mockito.Mockito.*; - -import org.alfresco.module.org_alfresco_module_rm.test.util.BaseUnitTest; -import org.alfresco.service.cmr.repository.NodeRef; -import org.junit.Before; -import org.junit.Test; -import org.mockito.InjectMocks; - -/** - * Frozen capability condition unit test - * - * @author Roy Wetherall - * @since 2.3 - */ -public class FrozenCapabilityConditionUnitTest extends BaseUnitTest -{ - /** evaluator */ - private @InjectMocks FrozenCapabilityCondition condition; - - /** - * @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseUnitTest#before() - */ - @Before - @Override - public void before() throws Exception - { - super.before(); - } - - /** - * Given hold - * When evaluate - * Then true - */ - @Test - public void evaluateHold() - { - // is a hold - NodeRef nodeRef = generateNodeRef(); - when(mockedHoldService.isHold(nodeRef)) - .thenReturn(true); - - // evaluate - assertTrue(condition.evaluate(nodeRef)); - - // verify - verify(mockedHoldService, times(1)).isHold(nodeRef); - verify(mockedFreezeService, never()).isFrozen(nodeRef); - verify(mockedFreezeService, never()).hasFrozenChildren(nodeRef); - } - - /** - * Given is frozen - * And no check children - * When evaluate - * Then true - */ - @Test - public void frozenDontCheckChildren() - { - // is not a hold - NodeRef nodeRef = generateNodeRef(); - when(mockedHoldService.isHold(nodeRef)) - .thenReturn(false); - - // dont check children - condition.setCheckChildren(false); - - // is frozen - when(mockedFreezeService.isFrozen(nodeRef)) - .thenReturn(true); - - // evaluate - assertTrue(condition.evaluate(nodeRef)); - - // verify - verify(mockedHoldService, times(1)).isHold(nodeRef); - verify(mockedFreezeService, times(1)).isFrozen(nodeRef); - verify(mockedFreezeService, never()).hasFrozenChildren(nodeRef); - } - - /** - * Given is not frozen - * And no check children - * When evaluate - * Then false - */ - @Test - public void notFrozenDontCheckChildren() - { - // is not a hold - NodeRef nodeRef = generateNodeRef(); - when(mockedHoldService.isHold(nodeRef)) - .thenReturn(false); - - // dont check children - condition.setCheckChildren(false); - - // is not frozen - when(mockedFreezeService.isFrozen(nodeRef)) - .thenReturn(false); - - // evaluate - assertFalse(condition.evaluate(nodeRef)); - - // verify - verify(mockedHoldService, times(1)).isHold(nodeRef); - verify(mockedFreezeService, times(1)).isFrozen(nodeRef); - verify(mockedFreezeService, never()).hasFrozenChildren(nodeRef); - } - - /** - * Given is frozen - * And check children - * When evaluate - * Then true - */ - @Test - public void frozenCheckChildren() - { - // is not a hold - NodeRef nodeRef = generateNodeRef(); - when(mockedHoldService.isHold(nodeRef)) - .thenReturn(false); - - // check children - condition.setCheckChildren(true); - - // is frozen - when(mockedFreezeService.isFrozen(nodeRef)) - .thenReturn(true); - - // evaluate - assertTrue(condition.evaluate(nodeRef)); - - // verify - verify(mockedHoldService, times(1)).isHold(nodeRef); - verify(mockedFreezeService, times(1)).isFrozen(nodeRef); - verify(mockedFreezeService, never()).hasFrozenChildren(nodeRef); - } - - /** - * Given is not frozen - * And check children - * And children no frozen - * When evaluate - * Then false - */ - @Test - public void notFrozenCheckChildrenNotFrozen() - { - // is not a hold - NodeRef nodeRef = generateNodeRef(); - when(mockedHoldService.isHold(nodeRef)) - .thenReturn(false); - - // check children - condition.setCheckChildren(true); - - // is not frozen - when(mockedFreezeService.isFrozen(nodeRef)) - .thenReturn(false); - - // children not frozen - when(mockedFreezeService.hasFrozenChildren(nodeRef)) - .thenReturn(false); - - // evaluate - assertFalse(condition.evaluate(nodeRef)); - - // verify - verify(mockedHoldService, times(1)).isHold(nodeRef); - verify(mockedFreezeService, times(1)).isFrozen(nodeRef); - verify(mockedFreezeService, times(1)).hasFrozenChildren(nodeRef); - } - - /** - * Given is not frozen - * And check children - * And children frozen - * When evaluate - * Then true - */ - @Test - public void notFrozenCheckChildrenFrozen() - { - // is not a hold - NodeRef nodeRef = generateNodeRef(); - when(mockedHoldService.isHold(nodeRef)) - .thenReturn(false); - - // check children - condition.setCheckChildren(true); - - // is not frozen - when(mockedFreezeService.isFrozen(nodeRef)) - .thenReturn(false); - - // children frozen - when(mockedFreezeService.hasFrozenChildren(nodeRef)) - .thenReturn(true); - - // evaluate - assertTrue(condition.evaluate(nodeRef)); - - // verify - verify(mockedHoldService, times(1)).isHold(nodeRef); - verify(mockedFreezeService, times(1)).isFrozen(nodeRef); - verify(mockedFreezeService, times(1)).hasFrozenChildren(nodeRef); - } -} diff --git a/rm-server/unit-test/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/HoldCapabilityConditionUnitTest.java b/rm-server/unit-test/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/HoldCapabilityConditionUnitTest.java index ad4b3484bf..14cee5c43a 100644 --- a/rm-server/unit-test/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/HoldCapabilityConditionUnitTest.java +++ b/rm-server/unit-test/java/org/alfresco/module/org_alfresco_module_rm/capability/declarative/condition/HoldCapabilityConditionUnitTest.java @@ -57,17 +57,17 @@ public class HoldCapabilityConditionUnitTest extends BaseUnitTest private List holds; /** mocked objects */ - private @Mock(name="kinds") Set mockedKinds; + @Mock(name="kinds") Set mockedKinds; /** evaluator */ - private @Spy @InjectMocks HoldCapabilityCondition evaluator; + @Spy @InjectMocks HoldCapabilityCondition evaluator; /** * @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseUnitTest#before() */ @Before @Override - public void before() throws Exception + public void before() { super.before(); diff --git a/rm-server/unit-test/java/org/alfresco/module/org_alfresco_module_rm/capability/impl/EditNonRecordsMetadataCapabilityUnitTest.java b/rm-server/unit-test/java/org/alfresco/module/org_alfresco_module_rm/capability/impl/EditNonRecordsMetadataCapabilityUnitTest.java deleted file mode 100644 index e622588d5c..0000000000 --- a/rm-server/unit-test/java/org/alfresco/module/org_alfresco_module_rm/capability/impl/EditNonRecordsMetadataCapabilityUnitTest.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright (C) 2005-2014 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - */ -package org.alfresco.module.org_alfresco_module_rm.capability.impl; - -import static org.mockito.Mockito.when; - -import java.util.Set; - -import net.sf.acegisecurity.vote.AccessDecisionVoter; - -import org.alfresco.module.org_alfresco_module_rm.record.RecordServiceImpl; -import org.alfresco.module.org_alfresco_module_rm.test.util.BaseUnitTest; -import org.alfresco.service.cmr.repository.NodeRef; -import org.junit.Assert; -import org.junit.Test; -import org.mockito.InjectMocks; -import org.mockito.Mock; - -/** - * Edit non records metadata capability unit test - * - * @author Roy Wetherall - * @since 2.3 - */ -public class EditNonRecordsMetadataCapabilityUnitTest extends BaseUnitTest -{ - /** mocked set */ - @Mock private Set mockedSet; - - /** test capability */ - @InjectMocks private EditNonRecordMetadataCapability capability; - - /** - * Given that the evaluated node is held in the transaction cache as new - * When evaluated - * Then access is granted - */ - @Test - public void newRecord() - { - NodeRef nodeRef = generateNodeRef(); - when(mockedTransactionalResourceHelper.getSet(RecordServiceImpl.KEY_NEW_RECORDS)) - .thenReturn(mockedSet); - when(mockedSet.contains(nodeRef)) - .thenReturn(true); - - Assert.assertEquals(AccessDecisionVoter.ACCESS_GRANTED, capability.evaluate(nodeRef)); - } -} diff --git a/rm-server/unit-test/java/org/alfresco/module/org_alfresco_module_rm/hold/HoldServiceImplUnitTest.java b/rm-server/unit-test/java/org/alfresco/module/org_alfresco_module_rm/hold/HoldServiceImplUnitTest.java index 4b017a54cf..a275d7260b 100644 --- a/rm-server/unit-test/java/org/alfresco/module/org_alfresco_module_rm/hold/HoldServiceImplUnitTest.java +++ b/rm-server/unit-test/java/org/alfresco/module/org_alfresco_module_rm/hold/HoldServiceImplUnitTest.java @@ -77,7 +77,7 @@ public class HoldServiceImplUnitTest extends BaseUnitTest @Before @Override - public void before() throws Exception + public void before() { super.before(); diff --git a/rm-server/unit-test/java/org/alfresco/module/org_alfresco_module_rm/job/DispositionLifecycleJobExecuterUnitTest.java b/rm-server/unit-test/java/org/alfresco/module/org_alfresco_module_rm/job/DispositionLifecycleJobExecuterUnitTest.java index 813cb9611b..8d82002c19 100644 --- a/rm-server/unit-test/java/org/alfresco/module/org_alfresco_module_rm/job/DispositionLifecycleJobExecuterUnitTest.java +++ b/rm-server/unit-test/java/org/alfresco/module/org_alfresco_module_rm/job/DispositionLifecycleJobExecuterUnitTest.java @@ -47,7 +47,7 @@ import org.mockito.Mock; /** * Disposition lifecycle job execution unit test. - * + * * @author Roy Wetherall * @since 2.2 */ @@ -57,43 +57,43 @@ public class DispositionLifecycleJobExecuterUnitTest extends BaseUnitTest private static final String CUTOFF = "cutoff"; private static final String RETAIN = "retain"; private static final String DESTROY = "destroy"; - + /** test query snipit */ private static final String QUERY = "\"" + CUTOFF + "\" OR \"" + RETAIN + "\""; - + /** mocked result set */ @Mock ResultSet mockedResultSet; - + /** disposition lifecycle job executer */ @InjectMocks DispositionLifecycleJobExecuter executer; - + /** * @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseUnitTest#before() */ @Override @Before - public void before() throws Exception + public void before() { super.before(); - + // setup data List dispositionActions = buildList(CUTOFF, RETAIN); executer.setDispositionActions(dispositionActions); - + // setup interactions - doReturn(mockedResultSet).when(mockedSearchService).query(eq(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE), eq(SearchService.LANGUAGE_FTS_ALFRESCO), anyString()); + doReturn(mockedResultSet).when(mockedSearchService).query(eq(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE), eq(SearchService.LANGUAGE_LUCENE), anyString()); } - + /** * Helper method to verify that the query has been executed and closed */ private void verifyQuery() { - verify(mockedSearchService, times(1)).query(eq(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE), eq(SearchService.LANGUAGE_FTS_ALFRESCO), contains(QUERY)); + verify(mockedSearchService, times(1)).query(eq(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE), eq(SearchService.LANGUAGE_LUCENE), contains(QUERY)); verify(mockedResultSet, times(1)).getNodeRefs(); - verify(mockedResultSet, times(1)).close(); + verify(mockedResultSet, times(1)).close(); } - + /** * When the are no results in query. */ @@ -102,19 +102,19 @@ public class DispositionLifecycleJobExecuterUnitTest extends BaseUnitTest { // given doReturn(Collections.EMPTY_LIST).when(mockedResultSet).getNodeRefs(); - + // when executer.executeImpl(); - + // then - + // ensure the query is executed and closed verifyQuery(); - + // ensure nothing else happens becuase we have no results verifyZeroInteractions(mockedNodeService, mockedRecordFolderService, mockedRetryingTransactionHelper); } - + /** * When the disposition actions do not match those that can be processed automatically. */ @@ -126,34 +126,34 @@ public class DispositionLifecycleJobExecuterUnitTest extends BaseUnitTest NodeRef node1 = generateNodeRef(); NodeRef node2 = generateNodeRef(); List nodeRefs = buildList(node1, node2); - + // given doReturn(nodeRefs).when(mockedResultSet).getNodeRefs(); doReturn(DESTROY).when(mockedNodeService).getProperty(node1, RecordsManagementModel.PROP_DISPOSITION_ACTION); doReturn(DESTROY).when(mockedNodeService).getProperty(node2, RecordsManagementModel.PROP_DISPOSITION_ACTION); - + // when executer.executeImpl(); - + // then - + // ensure the query is executed and closed verifyQuery(); - + // ensure work is executed in transaction for each node processed verify(mockedNodeService, times(2)).exists(any(NodeRef.class)); verify(mockedRetryingTransactionHelper, times(2)).doInTransaction(any(RetryingTransactionCallback.class)); - + // ensure each node is process correctly verify(mockedNodeService, times(1)).getProperty(node1, RecordsManagementModel.PROP_DISPOSITION_ACTION); verify(mockedNodeService, times(1)).getProperty(node2, RecordsManagementModel.PROP_DISPOSITION_ACTION); - + // ensure no more interactions verifyNoMoreInteractions(mockedNodeService); verifyZeroInteractions(mockedRecordsManagementActionService); - + } - + /** * When a node does not exist */ @@ -163,26 +163,26 @@ public class DispositionLifecycleJobExecuterUnitTest extends BaseUnitTest // test data NodeRef node1 = generateNodeRef(null, false); List nodeRefs = buildList(node1); - + // given doReturn(nodeRefs).when(mockedResultSet).getNodeRefs(); - + // when executer.executeImpl(); - + // then - + // ensure the query is executed and closed verifyQuery(); - + // ensure the node exist check is made for the node verify(mockedNodeService, times(1)).exists(any(NodeRef.class)); - + // ensure no more interactions verifyNoMoreInteractions(mockedNodeService); - verifyZeroInteractions(mockedRecordsManagementActionService, mockedRetryingTransactionHelper); + verifyZeroInteractions(mockedRecordsManagementActionService, mockedRetryingTransactionHelper); } - + /** * When there are disposition actions eligible for processing */ @@ -195,26 +195,26 @@ public class DispositionLifecycleJobExecuterUnitTest extends BaseUnitTest NodeRef node2 = generateNodeRef(); List nodeRefs = buildList(node1, node2); NodeRef parent = generateNodeRef(); - ChildAssociationRef parentAssoc = new ChildAssociationRef(ASSOC_NEXT_DISPOSITION_ACTION, parent, generateQName(), generateNodeRef()); - + ChildAssociationRef parentAssoc = new ChildAssociationRef(ASSOC_NEXT_DISPOSITION_ACTION, parent, generateQName(), generateNodeRef()); + // given doReturn(nodeRefs).when(mockedResultSet).getNodeRefs(); doReturn(CUTOFF).when(mockedNodeService).getProperty(node1, RecordsManagementModel.PROP_DISPOSITION_ACTION); doReturn(RETAIN).when(mockedNodeService).getProperty(node2, RecordsManagementModel.PROP_DISPOSITION_ACTION); doReturn(parentAssoc).when(mockedNodeService).getPrimaryParent(any(NodeRef.class)); - + // when executer.executeImpl(); - + // then - + // ensure the query is executed and closed verifyQuery(); - + // ensure work is executed in transaction for each node processed verify(mockedNodeService, times(2)).exists(any(NodeRef.class)); verify(mockedRetryingTransactionHelper, times(2)).doInTransaction(any(RetryingTransactionCallback.class)); - + // ensure each node is process correctly // node1 verify(mockedNodeService, times(1)).getProperty(node1, RecordsManagementModel.PROP_DISPOSITION_ACTION); @@ -224,7 +224,7 @@ public class DispositionLifecycleJobExecuterUnitTest extends BaseUnitTest verify(mockedNodeService, times(1)).getProperty(node2, RecordsManagementModel.PROP_DISPOSITION_ACTION); verify(mockedNodeService, times(1)).getPrimaryParent(node2); verify(mockedRecordsManagementActionService, times(1)).executeRecordsManagementAction(eq(parent), eq(RETAIN), anyMap()); - + // ensure no more interactions verifyNoMoreInteractions(mockedNodeService, mockedRecordsManagementActionService); } diff --git a/rm-server/unit-test/java/org/alfresco/module/org_alfresco_module_rm/jscript/app/evaluator/FrozenEvaluatorUnitTest.java b/rm-server/unit-test/java/org/alfresco/module/org_alfresco_module_rm/jscript/app/evaluator/FrozenEvaluatorUnitTest.java index e8d510a30a..22d3cf8b37 100644 --- a/rm-server/unit-test/java/org/alfresco/module/org_alfresco_module_rm/jscript/app/evaluator/FrozenEvaluatorUnitTest.java +++ b/rm-server/unit-test/java/org/alfresco/module/org_alfresco_module_rm/jscript/app/evaluator/FrozenEvaluatorUnitTest.java @@ -50,7 +50,7 @@ public class FrozenEvaluatorUnitTest extends BaseUnitTest @Before @Override - public void before() throws Exception + public void before() { super.before(); diff --git a/rm-server/unit-test/java/org/alfresco/module/org_alfresco_module_rm/jscript/app/evaluator/TransferEvaluatorUnitTest.java b/rm-server/unit-test/java/org/alfresco/module/org_alfresco_module_rm/jscript/app/evaluator/TransferEvaluatorUnitTest.java index 2dfdd1b359..0d8d460860 100644 --- a/rm-server/unit-test/java/org/alfresco/module/org_alfresco_module_rm/jscript/app/evaluator/TransferEvaluatorUnitTest.java +++ b/rm-server/unit-test/java/org/alfresco/module/org_alfresco_module_rm/jscript/app/evaluator/TransferEvaluatorUnitTest.java @@ -51,7 +51,7 @@ public class TransferEvaluatorUnitTest extends BaseUnitTest @Spy @InjectMocks TransferEvaluator transferEvaluator; @Override - public void before() throws Exception + public void before() { super.before(); diff --git a/rm-server/unit-test/java/org/alfresco/module/org_alfresco_module_rm/patch/v22/RMv22CapabilityPatchUnitTest.java b/rm-server/unit-test/java/org/alfresco/module/org_alfresco_module_rm/patch/v22/RMv22CapabilityPatchUnitTest.java new file mode 100644 index 0000000000..aa080f0977 --- /dev/null +++ b/rm-server/unit-test/java/org/alfresco/module/org_alfresco_module_rm/patch/v22/RMv22CapabilityPatchUnitTest.java @@ -0,0 +1,124 @@ +/* + * Copyright (C) 2005-2014 Alfresco Software Limited. + * + * This file is part of Alfresco + * + * Alfresco is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Alfresco is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + */ +package org.alfresco.module.org_alfresco_module_rm.patch.v22; + +import static org.mockito.Matchers.anyString; +import static org.mockito.Matchers.eq; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; + +import java.util.Collections; + +import org.alfresco.module.org_alfresco_module_rm.role.FilePlanRoleService; +import org.alfresco.module.org_alfresco_module_rm.test.util.BaseUnitTest; +import org.alfresco.service.cmr.security.AuthorityType; +import org.junit.Test; +import org.mockito.InjectMocks; + +/** + * Unit test for RMv22CapabilityPatch + * + * @author Roy Wetherall + */ +public class RMv22CapabilityPatchUnitTest extends BaseUnitTest +{ + /** patch */ + private @InjectMocks RMv22CapabilityPatch patch; + + /** + * Given that I am upgrading an existing repository to v2.2 + * When I execute the patch + * Then the capabilities are updated + */ + @Test + public void executePatch() + { + when(mockedFilePlanService.getFilePlans()) + .thenReturn(Collections.singleton(filePlan)); + when(mockedAuthorityService.getName(eq(AuthorityType.GROUP), anyString())) + .thenReturn( + FilePlanRoleService.ROLE_ADMIN, + FilePlanRoleService.ROLE_RECORDS_MANAGER, + FilePlanRoleService.ROLE_ADMIN, + FilePlanRoleService.ROLE_RECORDS_MANAGER, + FilePlanRoleService.ROLE_ADMIN, + FilePlanRoleService.ROLE_RECORDS_MANAGER, + FilePlanRoleService.ROLE_ADMIN, + FilePlanRoleService.ROLE_RECORDS_MANAGER, + FilePlanRoleService.ROLE_SECURITY_OFFICER, + FilePlanRoleService.ROLE_RECORDS_MANAGER); + + // execute patch + patch.applyInternal(); + + // verify that the correct capabilities have been added + verify(mockedPermissionService, times(1)).setPermission( + filePlan, + FilePlanRoleService.ROLE_ADMIN, + "FileDestructionReport", + true); + verify(mockedPermissionService, times(1)).setPermission( + filePlan, + FilePlanRoleService.ROLE_RECORDS_MANAGER, + "FileDestructionReport", + true); + verify(mockedPermissionService, times(1)).setPermission( + filePlan, + FilePlanRoleService.ROLE_ADMIN, + "CreateHold", + true); + verify(mockedPermissionService, times(1)).setPermission( + filePlan, + FilePlanRoleService.ROLE_RECORDS_MANAGER, + "CreateHold", + true); + verify(mockedPermissionService, times(1)).setPermission( + filePlan, + FilePlanRoleService.ROLE_ADMIN, + "AddToHold", + true); + verify(mockedPermissionService, times(1)).setPermission( + filePlan, + FilePlanRoleService.ROLE_RECORDS_MANAGER, + "AddToHold", + true); + verify(mockedPermissionService, times(1)).setPermission( + filePlan, + FilePlanRoleService.ROLE_ADMIN, + "RemoveFromHold", + true); + verify(mockedPermissionService, times(1)).setPermission( + filePlan, + FilePlanRoleService.ROLE_RECORDS_MANAGER, + "RemoveFromHold", + true); + verify(mockedPermissionService, times(1)).setPermission( + filePlan, + FilePlanRoleService.ROLE_RECORDS_MANAGER, + "ManageAccessControls", + true); + verify(mockedPermissionService, times(1)).setPermission( + filePlan, + FilePlanRoleService.ROLE_SECURITY_OFFICER, + "ManageAccessControls", + true); + } + +} diff --git a/rm-server/unit-test/java/org/alfresco/module/org_alfresco_module_rm/record/RecordServiceImplUnitTest.java b/rm-server/unit-test/java/org/alfresco/module/org_alfresco_module_rm/record/RecordServiceImplUnitTest.java index 0f2ac51bfe..bfeaf13b69 100755 --- a/rm-server/unit-test/java/org/alfresco/module/org_alfresco_module_rm/record/RecordServiceImplUnitTest.java +++ b/rm-server/unit-test/java/org/alfresco/module/org_alfresco_module_rm/record/RecordServiceImplUnitTest.java @@ -21,32 +21,18 @@ package org.alfresco.module.org_alfresco_module_rm.record; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertTrue; -import static org.mockito.Matchers.any; -import static org.mockito.Mockito.doNothing; -import static org.mockito.Mockito.doReturn; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.never; -import static org.mockito.Mockito.times; -import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; -import java.util.HashSet; import java.util.Map; import java.util.Set; -import org.alfresco.model.ContentModel; -import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionSchedule; import org.alfresco.module.org_alfresco_module_rm.test.util.BaseUnitTest; -import org.alfresco.repo.policy.Behaviour; -import org.alfresco.service.cmr.repository.ChildAssociationRef; import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.namespace.NamespaceService; import org.alfresco.service.namespace.QName; import org.apache.commons.collections.CollectionUtils; import org.junit.Before; import org.junit.Test; import org.mockito.InjectMocks; -import org.mockito.Spy; /** * Unit test for RecordServiceImpl @@ -62,12 +48,12 @@ public class RecordServiceImplUnitTest extends BaseUnitTest private static QName TYPE_MY_FILE_PLAN = generateQName(); private static QName ASPECT_FOR_FILE_PLAN = generateQName(); - @Spy @InjectMocks private RecordServiceImpl recordService; + @InjectMocks private RecordServiceImpl recordService; @SuppressWarnings("unchecked") @Before @Override - public void before() throws Exception + public void before() { super.before(); @@ -79,9 +65,6 @@ public class RecordServiceImplUnitTest extends BaseUnitTest // set-up dictionary service when(mockedDictionaryService.getAllAspects()).thenReturn(CollectionUtils.EMPTY_COLLECTION); - - // mock up getting behaviours - when(recordService.getBehaviour(any(String.class))).thenReturn(mock(Behaviour.class)); } @Test @@ -98,358 +81,4 @@ public class RecordServiceImplUnitTest extends BaseUnitTest assertEquals(1, types.size()); assertTrue(types.contains(TYPE_FILE_PLAN)); } - - /** - * Given invalid types - * When linking - * Then exception thrown - */ - @Test - public void linkNonRecord() - { - NodeRef nonRecord = generateNodeRef(TYPE_CONTENT); - NodeRef recordFolder = generateRecordFolder(); - - // set expected exception - exception.expect(RecordLinkRuntimeException.class); - - // link - recordService.link(nonRecord, recordFolder); - } - @Test - public void linkNonRecordFolder() - { - NodeRef record = generateRecord(); - NodeRef nonRecordFolder = generateNodeRef(TYPE_FOLDER); - - // set expected exception - exception.expect(RecordLinkRuntimeException.class); - - // link - recordService.link(record, nonRecordFolder); - } - - /** - * Given that the record is already a child of the record folder - * When I try to link the record to the same record folder - * Then an exception is thrown - */ - @Test - public void linkRecordToRecordFolderFailsIfAlreadyAChild() - { - NodeRef record = generateRecord(); - NodeRef recordFolder = generateRecordFolder(); - - // given that the record is already a child of the record folder - makeChildrenOf(recordFolder, record); - - // set expected exception - exception.expect(RecordLinkRuntimeException.class); - - // link - recordService.link(record, recordFolder); - } - - /** - * Given a record that is not a child of a record folder - * When I link the record to the record folder - * Then the record is now linked to the record folder - */ - @Test - public void linkRecordToRecordFolder() - { - NodeRef record = generateRecord(); - NodeRef recordFolder = generateRecordFolder(); - - // given that the record is already a child of the record folder - makeChildrenOf(generateRecordFolder(), record); - - // set the name of the record - String name = generateText(); - doReturn(name).when(mockedNodeService).getProperty(record, PROP_NAME); - - // link - recordService.link(record, recordFolder); - - // verify link was created - verify(mockedNodeService, times(1)).addChild( - recordFolder, - record, - ContentModel.ASSOC_CONTAINS, - QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, name)); - } - - /** - * Given that the source record has no disposition schedule - * When I link - * Then it is successful - */ - @Test public void linkNoSourceDisposition() - { - // create record and record folder - NodeRef record = generateRecord(); - NodeRef recordFolder = generateRecordFolder(); - makeChildrenOf(generateRecordFolder(), record); - - // set the name of the record - String name = generateText(); - doReturn(name).when(mockedNodeService).getProperty(record, PROP_NAME); - - // set dispositions - when(mockedDispositionService.getDispositionSchedule(record)) - .thenReturn(null); - - // link - recordService.link(record, recordFolder); - - // verify link was created - verify(mockedNodeService, times(1)).addChild( - recordFolder, - record, - ContentModel.ASSOC_CONTAINS, - QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, name)); - } - - /** - * Given that the target record folder has no disposition schedule - * When I link - * Then it is successful - */ - @Test public void linkNoTargetDisposition() - { - // create record and record folder - NodeRef record = generateRecord(); - NodeRef recordFolder = generateRecordFolder(); - makeChildrenOf(generateRecordFolder(), record); - - // set the name of the record - String name = generateText(); - doReturn(name).when(mockedNodeService).getProperty(record, PROP_NAME); - - // set dispositions - when(mockedDispositionService.getDispositionSchedule(record)) - .thenReturn(mock(DispositionSchedule.class)); - when(mockedDispositionService.getDispositionSchedule(record)) - .thenReturn(null); - - // link - recordService.link(record, recordFolder); - - // verify link was created - verify(mockedNodeService, times(1)).addChild( - recordFolder, - record, - ContentModel.ASSOC_CONTAINS, - QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, name)); - } - - /** - * Given that the source record and target record folder have incompatible disposition schedules - * When I link - * Then I expect a failure - */ - @Test public void linkIncompatibleDispositions() - { - // create record and record folder - NodeRef record = generateRecord(); - NodeRef recordFolder = generateRecordFolder(); - makeChildrenOf(generateRecordFolder(), record); - - // set the name of the record - String name = generateText(); - doReturn(name).when(mockedNodeService).getProperty(record, PROP_NAME); - - // set dispositions - DispositionSchedule recordDispositionSchedule = mock(DispositionSchedule.class); - when(recordDispositionSchedule.isRecordLevelDisposition()) - .thenReturn(true); - when(mockedDispositionService.getDispositionSchedule(record)) - .thenReturn(recordDispositionSchedule); - - DispositionSchedule recordFolderDispositionSchedule = mock(DispositionSchedule.class); - when(recordFolderDispositionSchedule.isRecordLevelDisposition()) - .thenReturn(false); - when(mockedDispositionService.getDispositionSchedule(recordFolder)) - .thenReturn(recordFolderDispositionSchedule); - - // expect exception - exception.expect(RecordLinkRuntimeException.class); - exception.expectMessage("incompatible disposition schedule"); - - // link - recordService.link(record, recordFolder); - } - - /** - * Given that the source record and target record folder have compatible disposition schedules - * When I link - * Then it is successful - */ - @Test public void linkCompatibleDispositions() - { - // create record and record folder - NodeRef record = generateRecord(); - NodeRef recordFolder = generateRecordFolder(); - makeChildrenOf(generateRecordFolder(), record); - - // set the name of the record - String name = generateText(); - doReturn(name).when(mockedNodeService).getProperty(record, PROP_NAME); - - // set dispositions - DispositionSchedule recordDispositionSchedule = mock(DispositionSchedule.class); - when(recordDispositionSchedule.isRecordLevelDisposition()) - .thenReturn(true); - when(mockedDispositionService.getDispositionSchedule(record)) - .thenReturn(recordDispositionSchedule); - - DispositionSchedule recordFolderDispositionSchedule = mock(DispositionSchedule.class); - when(recordFolderDispositionSchedule.isRecordLevelDisposition()) - .thenReturn(true); - when(mockedDispositionService.getDispositionSchedule(recordFolder)) - .thenReturn(recordFolderDispositionSchedule); - - // link - recordService.link(record, recordFolder); - - // verify link was created - verify(mockedNodeService, times(1)).addChild( - recordFolder, - record, - ContentModel.ASSOC_CONTAINS, - QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, name)); - } - - /** - * Given invalid types - * When unlinking - * Then exception thrown - */ - @Test - public void unlinkNonRecord() - { - NodeRef nonRecord = generateNodeRef(TYPE_CONTENT); - NodeRef recordFolder = generateRecordFolder(); - - // set expected exception - exception.expect(RecordLinkRuntimeException.class); - - // unlink - recordService.unlink(nonRecord, recordFolder); - } - @Test - public void unlinkNonRecordFolder() - { - NodeRef record = generateRecord(); - NodeRef nonRecordFolder = generateNodeRef(TYPE_FOLDER); - - // set expected exception - exception.expect(RecordLinkRuntimeException.class); - - // unlink - recordService.unlink(record, nonRecordFolder); - } - - /** - * Given a record folder is a records primary parent - * When I try and unlink the record from that record folder - * Then an exception is thrown - */ - @Test - public void unlinkRecordFromPrimaryRecordFolder() - { - NodeRef record = generateRecord(); - NodeRef recordFolder = generateRecordFolder(); - - // given that the record is already a child of the record folder - makePrimaryParentOf(record, recordFolder); - - // set expected exception - exception.expect(RecordLinkRuntimeException.class); - - // link - recordService.unlink(record, recordFolder); - } - - /** - * Given a record that is linked to a record - * And that the record is not the primary parent of the record - * When I unlink the record to the record folder - * Then the record is no longer linked to the record folder - */ - @Test - public void unlinkRecordFromRecordFolder() - { - NodeRef record = generateRecord(); - NodeRef recordFolder = generateRecordFolder(); - - // the records primary parent is another record folder - makePrimaryParentOf(record, generateRecordFolder()); - - // unlink - recordService.unlink(record, recordFolder); - - // verify link was created - verify(mockedNodeService, times(1)).removeChild(recordFolder, record); - } - - /** - * Given that a new record is being created - * When the behaviour is triggered - * Then the record is stored for later reference in the transaction - */ - @SuppressWarnings("unchecked") - @Test - public void onCreateChildAssociationNewRecord() - { - // standard content node - NodeRef nodeRef = generateCmContent("test.txt"); - ChildAssociationRef assoc = generateChildAssociationRef(generateNodeRef(), nodeRef); - - doNothing().when(recordService).file(nodeRef); - - // doesn't have no content aspect - when(mockedNodeService.hasAspect(nodeRef, ContentModel.ASPECT_NO_CONTENT)) - .thenReturn(false); - - Set values = mock(HashSet.class); - when(mockedTransactionalResourceHelper.getSet(RecordServiceImpl.KEY_NEW_RECORDS)) - .thenReturn(values); - - // trigger behaviour - recordService.onCreateChildAssociation(assoc, true); - - // verify - verify(values, times(1)).add(nodeRef); - } - - /** - * Given that an existing record is linked - * When the behaviour is triggered - * Then the record is not stored for later reference in the transaction - */ - @SuppressWarnings("unchecked") - @Test - public void onCreateChildAssociationExistingRecord() - { - // standard content node - NodeRef nodeRef = generateCmContent("test.txt"); - ChildAssociationRef assoc = generateChildAssociationRef(generateNodeRef(), nodeRef); - - doNothing().when(recordService).file(nodeRef); - - // doesn't have no content aspect - when(mockedNodeService.hasAspect(nodeRef, ContentModel.ASPECT_NO_CONTENT)) - .thenReturn(false); - - Set values = mock(HashSet.class); - when(mockedTransactionalResourceHelper.getSet(RecordServiceImpl.KEY_NEW_RECORDS)) - .thenReturn(values); - - // trigger behaviour - recordService.onCreateChildAssociation(assoc, false); - - // verify - verify(values, never()).add(nodeRef); - } } diff --git a/rm-server/unit-test/java/org/alfresco/module/org_alfresco_module_rm/recorded/version/config/BaseRecordedVersionConfigTest.java b/rm-server/unit-test/java/org/alfresco/module/org_alfresco_module_rm/recorded/version/config/BaseRecordedVersionConfigTest.java deleted file mode 100644 index 16e4ab880a..0000000000 --- a/rm-server/unit-test/java/org/alfresco/module/org_alfresco_module_rm/recorded/version/config/BaseRecordedVersionConfigTest.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (C) 2005-2014 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - */ -package org.alfresco.module.org_alfresco_module_rm.recorded.version.config; - -import java.util.Map; - -import org.alfresco.module.org_alfresco_module_rm.test.util.BaseWebScriptUnitTest; -import org.alfresco.module.org_alfresco_module_rm.version.RecordableVersionModel; -import org.alfresco.service.cmr.repository.NodeRef; - -/** - * Base test class for the recorded version config tests - * - * @author Tuna Aksoy - * @since 2.3 - */ -public abstract class BaseRecordedVersionConfigTest extends BaseWebScriptUnitTest implements RecordableVersionModel -{ - /** Recorded version config web script root folder */ - protected static final String RECORDED_VERSION_CONFIG_WEBSCRIPT_ROOT = "alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/"; - - /** Node ref for test document */ - protected NodeRef testdoc; - - /** Setup web script parameters */ - protected Map buildParameters() - { - testdoc = generateCmContent("testdoc.txt"); - - return buildParameters - ( - "store_type", testdoc.getStoreRef().getProtocol(), - "store_id", testdoc.getStoreRef().getIdentifier(), - "id", testdoc.getId() - ); - } -} diff --git a/rm-server/unit-test/java/org/alfresco/module/org_alfresco_module_rm/recorded/version/config/RecordedVersionConfigGetTest.java b/rm-server/unit-test/java/org/alfresco/module/org_alfresco_module_rm/recorded/version/config/RecordedVersionConfigGetTest.java deleted file mode 100644 index 60a404e8e1..0000000000 --- a/rm-server/unit-test/java/org/alfresco/module/org_alfresco_module_rm/recorded/version/config/RecordedVersionConfigGetTest.java +++ /dev/null @@ -1,127 +0,0 @@ -/* - * Copyright (C) 2005-2014 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - */ -package org.alfresco.module.org_alfresco_module_rm.recorded.version.config; - -import static org.alfresco.module.org_alfresco_module_rm.version.RecordableVersionPolicy.ALL; -import static org.alfresco.module.org_alfresco_module_rm.version.RecordableVersionPolicy.MAJOR_ONLY; -import static org.alfresco.module.org_alfresco_module_rm.version.RecordableVersionPolicy.NONE; -import static org.junit.Assert.assertNotNull; -import static org.mockito.Mockito.doReturn; -import static org.testng.Assert.assertEquals; -import static org.testng.Assert.assertTrue; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; -import java.util.Map; - -import org.alfresco.module.org_alfresco_module_rm.script.slingshot.RecordedVersionConfigGet; -import org.alfresco.module.org_alfresco_module_rm.script.slingshot.Version; -import org.alfresco.module.org_alfresco_module_rm.version.RecordableVersionPolicy; -import org.json.JSONArray; -import org.json.JSONObject; -import org.junit.Test; -import org.mockito.InjectMocks; -import org.springframework.extensions.webscripts.DeclarativeWebScript; - -/** - * Recorded Version Config REST API GET implementation unit test. - * - * @author Tuna Aksoy - * @since 2.3 - */ -public class RecordedVersionConfigGetTest extends BaseRecordedVersionConfigTest -{ - /** RecordedVersionConfigGet webscript instance */ - protected @InjectMocks RecordedVersionConfigGet webScript; - - /** - * @see org.alfresco.module.org_alfresco_module_rm.recorded.version.config.BaseRecordedVersionConfigTest#getWebScript() - */ - @Override - protected DeclarativeWebScript getWebScript() - { - return webScript; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.recorded.version.config.BaseRecordedVersionConfigTest#getWebScriptTemplate() - */ - @Override - protected String getWebScriptTemplate() - { - return RECORDED_VERSION_CONFIG_WEBSCRIPT_ROOT + "recorded-version-config.get.json.ftl"; - } - - @Test - public void getRecordedVersionConfig() throws Exception - { - // Build parameters - Map parameters = buildParameters(); - - // Test document should not have any recordable version policy set - doReturn(null).when(mockedNodeService).getProperty(testdoc, PROP_RECORDABLE_VERSION_POLICY); - - // Setup versions - List versions = Arrays.asList( - new Version(NONE.toString(), true), - new Version(MAJOR_ONLY.toString(), false), - new Version(ALL.toString(), false)); - - // Stub getVersions - doReturn(versions).when(mockedRecordableVersionConfigService).getVersions(testdoc); - - // Execute web script - JSONObject json = executeJSONWebScript(parameters); - - // Do checks - assertNotNull(json); - - assertTrue(json.has("data")); - JSONObject data = json.getJSONObject("data"); - assertNotNull(data); - - assertTrue(data.has("recordableVersions")); - JSONArray recordableVersions = data.getJSONArray("recordableVersions"); - assertNotNull(recordableVersions); - assertEquals(recordableVersions.length(), 3); - - List policies = new ArrayList(); - boolean isSelected = false; - int selectedOnce = 0; - for (int i = 0; i < recordableVersions.length(); i++) - { - JSONObject jsonObject = recordableVersions.getJSONObject(i); - String policy = jsonObject.getString("policy"); - policies.add(RecordableVersionPolicy.valueOf(policy)); - boolean selected = Boolean.valueOf(jsonObject.getString("selected")).booleanValue(); - if (selected) - { - isSelected = true; - selectedOnce++; - } - } - assertEquals(policies, Arrays.asList(RecordableVersionPolicy.values())); - assertTrue(isSelected); - assertEquals(selectedOnce, 1); - - // Test document should still not have any recordable version policy set - doReturn(null).when(mockedNodeService).getProperty(testdoc, PROP_RECORDABLE_VERSION_POLICY); - } -} diff --git a/rm-server/unit-test/java/org/alfresco/module/org_alfresco_module_rm/recorded/version/config/RecordedVersionConfigPostTest.java b/rm-server/unit-test/java/org/alfresco/module/org_alfresco_module_rm/recorded/version/config/RecordedVersionConfigPostTest.java deleted file mode 100644 index 969666ab75..0000000000 --- a/rm-server/unit-test/java/org/alfresco/module/org_alfresco_module_rm/recorded/version/config/RecordedVersionConfigPostTest.java +++ /dev/null @@ -1,104 +0,0 @@ -/* - * Copyright (C) 2005-2014 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - */ -package org.alfresco.module.org_alfresco_module_rm.recorded.version.config; - -import static org.alfresco.module.org_alfresco_module_rm.script.slingshot.RecordedVersionConfigPost.RECORDED_VERSION; -import static org.alfresco.module.org_alfresco_module_rm.version.RecordableVersionPolicy.ALL; -import static org.junit.Assert.assertNotNull; -import static org.mockito.Mockito.doReturn; -import static org.testng.Assert.assertEquals; - -import java.util.Map; - -import org.alfresco.module.org_alfresco_module_rm.script.slingshot.RecordedVersionConfigPost; -import org.alfresco.module.org_alfresco_module_rm.version.RecordableVersionPolicy; -import org.json.JSONObject; -import org.junit.Test; -import org.mockito.InjectMocks; -import org.springframework.extensions.webscripts.DeclarativeWebScript; - -/** - * Recorded Version Config REST API POST implementation unit test. - * - * @author Tuna Aksoy - * @since 2.3 - */ -public class RecordedVersionConfigPostTest extends BaseRecordedVersionConfigTest -{ - /** RecordedVersionConfigPost webscript instance */ - protected @InjectMocks RecordedVersionConfigPost webScript; - - /** - * @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseWebScriptUnitTest#getWebScript() - */ - @Override - protected DeclarativeWebScript getWebScript() - { - return webScript; - } - - /** - * @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseWebScriptUnitTest#getWebScriptTemplate() - */ - @Override - protected String getWebScriptTemplate() - { - return RECORDED_VERSION_CONFIG_WEBSCRIPT_ROOT + "recorded-version-config.post.json.ftl"; - } - - @Test - public void setRecordedVersionConfig() throws Exception - { - // Build the content - String content = buildContent(ALL); - - // Build parameters - Map parameters = buildParameters(); - - // Test document should not have any recordable version policy set - doReturn(null).when(mockedNodeService).getProperty(testdoc, PROP_RECORDABLE_VERSION_POLICY); - - // execute web script - JSONObject json = executeJSONWebScript(parameters, content); - - // Do checks - assertNotNull(json); - assertEquals(json.length(), 0); - - // Test document must have recordable version policy "ALL" set - doReturn(ALL).when(mockedNodeService).getProperty(testdoc, PROP_RECORDABLE_VERSION_POLICY); - } - - /** - * Helper method to build the content for the POST request - * @param policy The recordable version policy - * - * @return Content for the build request - */ - private String buildContent(RecordableVersionPolicy policy) - { - StringBuilder sb = new StringBuilder(); - sb.append("{\""); - sb.append(RECORDED_VERSION); - sb.append("\":\""); - sb.append(policy.toString()); - sb.append("\"}"); - return sb.toString(); - } -} diff --git a/rm-server/unit-test/java/org/alfresco/module/org_alfresco_module_rm/script/hold/BaseHoldWebScriptUnitTest.java b/rm-server/unit-test/java/org/alfresco/module/org_alfresco_module_rm/script/hold/BaseHoldWebScriptUnitTest.java index 16196af815..178dc61fa4 100644 --- a/rm-server/unit-test/java/org/alfresco/module/org_alfresco_module_rm/script/hold/BaseHoldWebScriptUnitTest.java +++ b/rm-server/unit-test/java/org/alfresco/module/org_alfresco_module_rm/script/hold/BaseHoldWebScriptUnitTest.java @@ -27,7 +27,7 @@ public abstract class BaseHoldWebScriptUnitTest extends BaseWebScriptUnitTest * @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseUnitTest#before() */ @Override - public void before() throws Exception + public void before() { super.before(); diff --git a/rm-server/unit-test/java/org/alfresco/module/org_alfresco_module_rm/script/hold/BaseHoldWebScriptWithContentUnitTest.java b/rm-server/unit-test/java/org/alfresco/module/org_alfresco_module_rm/script/hold/BaseHoldWebScriptWithContentUnitTest.java index e951c2069f..1746647af3 100644 --- a/rm-server/unit-test/java/org/alfresco/module/org_alfresco_module_rm/script/hold/BaseHoldWebScriptWithContentUnitTest.java +++ b/rm-server/unit-test/java/org/alfresco/module/org_alfresco_module_rm/script/hold/BaseHoldWebScriptWithContentUnitTest.java @@ -34,7 +34,7 @@ public abstract class BaseHoldWebScriptWithContentUnitTest extends BaseHoldWebSc boolean bFirst = true; for (NodeRef nodeRef : nodeRefs) { - if (!bFirst) + if (bFirst == false) { builder.append(","); } @@ -61,7 +61,7 @@ public abstract class BaseHoldWebScriptWithContentUnitTest extends BaseHoldWebSc boolean bFirst = true; for (NodeRef hold : holds) { - if (!bFirst) + if (bFirst == false) { builder.append(","); } diff --git a/rm-server/unit-test/java/org/alfresco/module/org_alfresco_module_rm/security/FilePlanPermissionServiceImplUnitTest.java b/rm-server/unit-test/java/org/alfresco/module/org_alfresco_module_rm/security/FilePlanPermissionServiceImplUnitTest.java index 430999961f..f3eac28f0b 100644 --- a/rm-server/unit-test/java/org/alfresco/module/org_alfresco_module_rm/security/FilePlanPermissionServiceImplUnitTest.java +++ b/rm-server/unit-test/java/org/alfresco/module/org_alfresco_module_rm/security/FilePlanPermissionServiceImplUnitTest.java @@ -83,10 +83,13 @@ public class FilePlanPermissionServiceImplUnitTest extends BaseUnitTest * @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseUnitTest#before() */ @Override - public void before() throws Exception + public void before() { super.before(); + // mock up run as methods + mockRunAsMethods(filePlanPermissionService); + // initialize node's unfiledRecordContainer = generateContainerNodeRef(TYPE_UNFILED_RECORD_CONTAINER); unfiledRecordFolder = generateContainerNodeRef(TYPE_UNFILED_RECORD_FOLDER); diff --git a/rm-server/unit-test/java/org/alfresco/module/org_alfresco_module_rm/test/AllUnitTestSuite.java b/rm-server/unit-test/java/org/alfresco/module/org_alfresco_module_rm/test/AllUnitTestSuite.java index 70d5e7247c..de7b7120b9 100644 --- a/rm-server/unit-test/java/org/alfresco/module/org_alfresco_module_rm/test/AllUnitTestSuite.java +++ b/rm-server/unit-test/java/org/alfresco/module/org_alfresco_module_rm/test/AllUnitTestSuite.java @@ -18,29 +18,22 @@ */ package org.alfresco.module.org_alfresco_module_rm.test; -import org.alfresco.module.org_alfresco_module_rm.action.dm.DeclareAsVersionRecordActionUnitTest; import org.alfresco.module.org_alfresco_module_rm.action.impl.FileReportActionUnitTest; -import org.alfresco.module.org_alfresco_module_rm.action.impl.UnlinkFromActionUnitTest; -import org.alfresco.module.org_alfresco_module_rm.bootstrap.BootstrapImporterModuleComponentUnitTest; -import org.alfresco.module.org_alfresco_module_rm.bootstrap.RecordContributorsGroupBootstrapComponentUnitTest; -import org.alfresco.module.org_alfresco_module_rm.capability.RMEntryVoterUnitTest; -import org.alfresco.module.org_alfresco_module_rm.capability.declarative.condition.CapabilityDeclarativeConditionSuite; -import org.alfresco.module.org_alfresco_module_rm.capability.impl.EditNonRecordsMetadataCapabilityUnitTest; +import org.alfresco.module.org_alfresco_module_rm.capability.declarative.condition.HoldCapabilityConditionUnitTest; import org.alfresco.module.org_alfresco_module_rm.forms.RecordsManagementTypeFormFilterUnitTest; import org.alfresco.module.org_alfresco_module_rm.hold.HoldServiceImplUnitTest; import org.alfresco.module.org_alfresco_module_rm.job.DispositionLifecycleJobExecuterUnitTest; import org.alfresco.module.org_alfresco_module_rm.jscript.app.evaluator.FrozenEvaluatorUnitTest; import org.alfresco.module.org_alfresco_module_rm.jscript.app.evaluator.TransferEvaluatorUnitTest; import org.alfresco.module.org_alfresco_module_rm.model.compatibility.DictionaryBootstrapPostProcessorUnitTest; +import org.alfresco.module.org_alfresco_module_rm.patch.v22.RMv22CapabilityPatchUnitTest; import org.alfresco.module.org_alfresco_module_rm.patch.v22.RMv22RemoveInPlaceRolesFromAllPatchUnitTest; import org.alfresco.module.org_alfresco_module_rm.record.RecordMetadataBootstrapUnitTest; import org.alfresco.module.org_alfresco_module_rm.record.RecordServiceImplUnitTest; -import org.alfresco.module.org_alfresco_module_rm.recorded.version.config.RecordedVersionConfigGetTest; -import org.alfresco.module.org_alfresco_module_rm.recorded.version.config.RecordedVersionConfigPostTest; import org.alfresco.module.org_alfresco_module_rm.script.hold.HoldPostUnitTest; import org.alfresco.module.org_alfresco_module_rm.script.hold.HoldPutUnitTest; import org.alfresco.module.org_alfresco_module_rm.script.hold.HoldsGetUnitTest; -import org.alfresco.module.org_alfresco_module_rm.version.RecordableVersionServiceImplUnitTest; +import org.alfresco.module.org_alfresco_module_rm.util.BeanExtenderUnitTest; import org.alfresco.repo.action.parameter.DateParameterProcessorUnitTest; import org.junit.runner.RunWith; import org.junit.runners.Suite; @@ -59,45 +52,32 @@ import org.junit.runners.Suite.SuiteClasses; RecordsManagementTypeFormFilterUnitTest.class, DispositionLifecycleJobExecuterUnitTest.class, DictionaryBootstrapPostProcessorUnitTest.class, + BeanExtenderUnitTest.class, DateParameterProcessorUnitTest.class, - RMEntryVoterUnitTest.class, - + // services RecordServiceImplUnitTest.class, HoldServiceImplUnitTest.class, - // FilePlanPermissionServiceImplUnitTest.class, // removed because test unreliable on Bamboo - RecordableVersionServiceImplUnitTest.class, - + //FilePlanPermissionServiceImplUnitTest.class, + // evaluators TransferEvaluatorUnitTest.class, FrozenEvaluatorUnitTest.class, - // capabilities - EditNonRecordsMetadataCapabilityUnitTest.class, - // web scripts HoldsGetUnitTest.class, HoldPostUnitTest.class, HoldPutUnitTest.class, - + + // capability conditions + HoldCapabilityConditionUnitTest.class, + // action implementations FileReportActionUnitTest.class, - UnlinkFromActionUnitTest.class, - DeclareAsVersionRecordActionUnitTest.class, - + // patches RMv22RemoveInPlaceRolesFromAllPatchUnitTest.class, - - // recorded version config - RecordedVersionConfigGetTest.class, - RecordedVersionConfigPostTest.class, - - // bootstrap - BootstrapImporterModuleComponentUnitTest.class, - RecordContributorsGroupBootstrapComponentUnitTest.class, - - // suites by package - CapabilityDeclarativeConditionSuite.class + RMv22CapabilityPatchUnitTest.class }) public class AllUnitTestSuite { diff --git a/rm-server/unit-test/java/org/alfresco/module/org_alfresco_module_rm/test/util/BaseUnitTest.java b/rm-server/unit-test/java/org/alfresco/module/org_alfresco_module_rm/test/util/BaseUnitTest.java index ab726af049..1686c07440 100644 --- a/rm-server/unit-test/java/org/alfresco/module/org_alfresco_module_rm/test/util/BaseUnitTest.java +++ b/rm-server/unit-test/java/org/alfresco/module/org_alfresco_module_rm/test/util/BaseUnitTest.java @@ -23,45 +23,29 @@ import static org.mockito.Matchers.anyString; import static org.mockito.Matchers.eq; import static org.mockito.Mockito.doAnswer; import static org.mockito.Mockito.doReturn; -import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; import java.util.ArrayList; import java.util.Collections; import java.util.List; -import java.util.UUID; import org.alfresco.model.ContentModel; import org.alfresco.module.org_alfresco_module_rm.action.RecordsManagementActionService; import org.alfresco.module.org_alfresco_module_rm.audit.RecordsManagementAuditService; -import org.alfresco.module.org_alfresco_module_rm.disposition.DispositionService; import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService; -import org.alfresco.module.org_alfresco_module_rm.freeze.FreezeService; import org.alfresco.module.org_alfresco_module_rm.hold.HoldService; import org.alfresco.module.org_alfresco_module_rm.identifier.IdentifierService; import org.alfresco.module.org_alfresco_module_rm.model.RecordsManagementModel; -import org.alfresco.module.org_alfresco_module_rm.model.rma.type.CmObjectType; -import org.alfresco.module.org_alfresco_module_rm.model.security.ModelSecurityService; import org.alfresco.module.org_alfresco_module_rm.record.RecordService; -import org.alfresco.module.org_alfresco_module_rm.recordableversion.RecordableVersionConfigService; import org.alfresco.module.org_alfresco_module_rm.recordfolder.RecordFolderService; import org.alfresco.module.org_alfresco_module_rm.report.ReportService; import org.alfresco.module.org_alfresco_module_rm.role.FilePlanRoleService; -import org.alfresco.module.org_alfresco_module_rm.security.ExtendedSecurityService; -import org.alfresco.module.org_alfresco_module_rm.util.AlfrescoTransactionSupport; -import org.alfresco.module.org_alfresco_module_rm.util.AuthenticationUtil; -import org.alfresco.module.org_alfresco_module_rm.util.TransactionalResourceHelper; -import org.alfresco.module.org_alfresco_module_rm.version.RecordableVersionService; -import org.alfresco.repo.policy.BehaviourFilter; -import org.alfresco.repo.policy.PolicyComponent; +import org.alfresco.module.org_alfresco_module_rm.util.ServiceBaseImpl; import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork; -import org.alfresco.repo.security.permissions.impl.ExtendedPermissionService; import org.alfresco.repo.transaction.RetryingTransactionHelper; import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback; import org.alfresco.service.cmr.dictionary.DictionaryService; -import org.alfresco.service.cmr.model.FileFolderService; import org.alfresco.service.cmr.repository.ChildAssociationRef; -import org.alfresco.service.cmr.repository.CopyService; import org.alfresco.service.cmr.repository.NodeRef; import org.alfresco.service.cmr.repository.NodeService; import org.alfresco.service.cmr.repository.StoreRef; @@ -89,33 +73,29 @@ import org.springframework.context.ApplicationContext; *

* Contains core and records management service mocks ready for injection. Helper methods * provide an easy way to build RM or Alfresco constructs for use in tests. - * + * * @author Roy Wetherall * @since 2.2 */ -public class BaseUnitTest implements RecordsManagementModel, ContentModel +public class BaseUnitTest implements RecordsManagementModel { protected NodeRef filePlanComponent; protected NodeRef filePlan; protected NodeRef recordFolder; protected NodeRef record; - + /** core service mocks */ - @Mock(name="nodeService") protected NodeService mockedNodeService; + @Mock(name="nodeService") protected NodeService mockedNodeService; @Mock(name="dictionaryService") protected DictionaryService mockedDictionaryService; - @Mock(name="namespaceService") protected NamespaceService mockedNamespaceService; + @Mock(name="namespaceService") protected NamespaceService mockedNamespaceService; @Mock(name="identifierService") protected IdentifierService mockedIdentifierService; @Mock(name="permissionService") protected PermissionService mockedPermissionService; @Mock(name="ownableService") protected OwnableService mockedOwnableService; @Mock(name="searchService") protected SearchService mockedSearchService; @Mock(name="retryingTransactionHelper") protected RetryingTransactionHelper mockedRetryingTransactionHelper; @Mock(name="authorityService") protected AuthorityService mockedAuthorityService; - @Mock(name="policyComponent") protected PolicyComponent mockedPolicyComponent; - @Mock(name="copyService") protected CopyService mockedCopyService; - @Mock(name="fileFolderService") protected FileFolderService mockedFileFolderService; - @Mock(name="modelSecurityService") protected ModelSecurityService mockedModelSecurityService; - + /** rm service mocks */ @Mock(name="filePlanService") protected FilePlanService mockedFilePlanService; @Mock(name="recordFolderService") protected RecordFolderService mockedRecordFolderService; @@ -125,37 +105,26 @@ public class BaseUnitTest implements RecordsManagementModel, ContentModel @Mock(name="reportService") protected ReportService mockedReportService; @Mock(name="filePlanRoleService") protected FilePlanRoleService mockedFilePlanRoleService; @Mock(name="recordsManagementAuditService") protected RecordsManagementAuditService mockedRecordsManagementAuditService; - @Mock(name="policyBehaviourFilter") protected BehaviourFilter mockedBehaviourFilter; - @Mock(name="authenticationUtil") protected AuthenticationUtil mockedAuthenticationUtil; - @Mock(name="extendedPermissionService") protected ExtendedPermissionService mockedExtendedPermissionService; - @Mock(name="extendedSecurityService") protected ExtendedSecurityService mockedExtendedSecurityService; - @Mock(name="recordableVersionConfigService") protected RecordableVersionConfigService mockedRecordableVersionConfigService; - @Mock(name="cmObjectType") protected CmObjectType mockedCmObjectType; - @Mock(name="recordableVersionService") protected RecordableVersionService mockedRecordableVersionService; - @Mock(name="transactionalResourceHelper") protected TransactionalResourceHelper mockedTransactionalResourceHelper; - @Mock(name="alfrescoTransactionSupport") protected AlfrescoTransactionSupport mockedAlfrescoTransactionSupport; - @Mock(name="freezeService") protected FreezeService mockedFreezeService; - @Mock(name="dispositionService") protected DispositionService mockedDispositionService; - + /** application context mock */ @Mock(name="applicationContext") protected ApplicationContext mockedApplicationContext; - + /** expected exception rule */ @Rule public ExpectedException exception = ExpectedException.none(); - + /** * Test method setup */ @SuppressWarnings("unchecked") @Before - public void before() throws Exception + public void before() { MockitoAnnotations.initMocks(this); - + // setup application context doReturn(mockedNodeService).when(mockedApplicationContext).getBean("dbNodeService"); - + // setup retrying transaction helper Answer doInTransactionAnswer = new Answer() { @@ -169,94 +138,45 @@ public class BaseUnitTest implements RecordsManagementModel, ContentModel }; doAnswer(doInTransactionAnswer).when(mockedRetryingTransactionHelper).doInTransaction(any(RetryingTransactionCallback.class)); - // setup mocked authentication util - setupAuthenticationUtilMock(); - - // setup file plan + // setup file plan filePlan = generateNodeRef(TYPE_FILE_PLAN); setupAsFilePlanComponent(filePlan); doReturn(true).when(mockedFilePlanService).isFilePlan(filePlan); - + // setup basic file plan component filePlanComponent = generateNodeRef(); setupAsFilePlanComponent(filePlanComponent); - + // setup namespace service doReturn(RM_URI).when(mockedNamespaceService).getNamespaceURI(RM_PREFIX); doReturn(CollectionUtils.unmodifiableSet(RM_PREFIX)).when(mockedNamespaceService).getPrefixes(RM_URI); - + // setup record folder and record recordFolder = generateRecordFolder(); record = generateRecord(); - + // set record as child of record folder List result = new ArrayList(1); result.add(new ChildAssociationRef(ContentModel.ASSOC_CONTAINS, recordFolder, generateQName(), record, true, 1)); doReturn(result).when(mockedNodeService).getChildAssocs(eq(recordFolder), eq(ContentModel.ASSOC_CONTAINS), any(QNamePattern.class)); doReturn(result).when(mockedNodeService).getParentAssocs(record); doReturn(Collections.singletonList(recordFolder)).when(mockedRecordFolderService).getRecordFolders(record); - doReturn(Collections.singletonList(record)).when(mockedRecordService).getRecords(recordFolder); + doReturn(Collections.singletonList(record)).when(mockedRecordService).getRecords(recordFolder); } - - /** - * Setup authentication util mock - */ - @SuppressWarnings("unchecked") - private void setupAuthenticationUtilMock() - { - // just do the work - doAnswer(new Answer() - { - @SuppressWarnings("rawtypes") - @Override - public Object answer(InvocationOnMock invocation) throws Throwable - { - RunAsWork work = (RunAsWork)invocation.getArguments()[0]; - return work.doWork(); - } - - }).when(mockedAuthenticationUtil).runAsSystem(any(RunAsWork.class)); - - // just do the work - doAnswer(new Answer() - { - @SuppressWarnings("rawtypes") - @Override - public Object answer(InvocationOnMock invocation) throws Throwable - { - RunAsWork work = (RunAsWork)invocation.getArguments()[0]; - return work.doWork(); - } - - }).when(mockedAuthenticationUtil).runAs(any(RunAsWork.class), anyString()); - - // assume admin - doReturn("admin").when(mockedAuthenticationUtil).getAdminUserName(); - doReturn("admin").when(mockedAuthenticationUtil).getFullyAuthenticatedUser(); - } - - /** - * Helper to generate random text value suitable for a property - * value or node name - */ - protected String generateText() - { - return UUID.randomUUID().toString(); - } - + /** * Helper method to generate a qname. - * + * * @return QName qualified name */ protected static QName generateQName() { return QName.createQName(RM_URI, GUID.generate()); } - + /** * Helper method to generate hold reference - * + * * @param name hold name * @return {@link NodeRef} node reference that will behave like a hold */ @@ -267,37 +187,37 @@ public class BaseUnitTest implements RecordsManagementModel, ContentModel doReturn(true).when(mockedHoldService).isHold(hold); return hold; } - + /** * Helper method to generate record folder reference - * + * * @return {@link NodeRef} node reference that will behave like a record folder */ protected NodeRef generateRecordFolder() { NodeRef recordFolder = generateNodeRef(TYPE_RECORD_FOLDER); - setupAsFilePlanComponent(recordFolder); + setupAsFilePlanComponent(recordFolder); doReturn(true).when(mockedRecordFolderService).isRecordFolder(recordFolder); - return recordFolder; + return recordFolder; } - + /** * Helper method to generate a record node reference. - * + * * @return {@link NodeRef} node reference that will behave like a record or type cm:content */ protected NodeRef generateRecord() { NodeRef record = generateNodeRef(ContentModel.TYPE_CONTENT); setupAsFilePlanComponent(record); - doReturn(true).when(mockedNodeService).hasAspect(record, ASPECT_RECORD); + doReturn(true).when(mockedNodeService).hasAspect(record, ASPECT_RECORD); doReturn(true).when(mockedRecordService).isRecord(record); return record; } - + /** * Helper method to setup a node reference as a file plan component. - * + * * @param nodeRef {@link NodeRef} node reference that will now behave like a file plan component */ protected void setupAsFilePlanComponent(NodeRef nodeRef) @@ -310,17 +230,17 @@ public class BaseUnitTest implements RecordsManagementModel, ContentModel /** * Helper method to generate a node reference. - * + * * @return {@link NodeRef} node reference that behaves like a node that exists in the spaces store */ protected NodeRef generateNodeRef() { return generateNodeRef(null); } - + /** * Helper method to generate a node reference of a particular type. - * + * * @param type content type qualified name * @return {@link NodeRef} node reference that behaves like a node that exists in the spaces store with * the content type provided @@ -329,23 +249,10 @@ public class BaseUnitTest implements RecordsManagementModel, ContentModel { return generateNodeRef(type, true); } - - /** - * Helper method to generate a cm:content node reference with a given name. - * - * @param name content name - * @return NodeRef node reference - */ - protected NodeRef generateCmContent(String name) - { - NodeRef nodeRef = generateNodeRef(ContentModel.TYPE_CONTENT, true); - doReturn(name).when(mockedNodeService).getProperty(nodeRef, ContentModel.PROP_NAME); - return nodeRef; - } - + /** * Helper method to generate a node reference of a particular type with a given existence characteristic. - * + * * @param type content type qualified name * @param exists indicates whether this node should behave like a node that exists or not * @return {@link NodeRef} node reference that behaves like a node that exists (or not) in the spaces store with @@ -361,61 +268,27 @@ public class BaseUnitTest implements RecordsManagementModel, ContentModel } return nodeRef; } - - /** - * Helper method to generate a mocked child association reference. - * - * @param parent parent node (optional) - * @param child child node (optional) - * @return {@link ChildAssociationRef} mocked to return the parent and child nodes - */ - protected ChildAssociationRef generateChildAssociationRef(NodeRef parent, NodeRef child) - { - ChildAssociationRef mockedChildAssociationRef = mock(ChildAssociationRef.class); - - if (parent != null) - { - doReturn(parent).when(mockedChildAssociationRef).getParentRef(); - } - - if (child != null) - { - doReturn(child).when(mockedChildAssociationRef).getChildRef(); - } - - return mockedChildAssociationRef; - } - + /** * Helper method to make one node the primary parent of the other. *

* Assumes the cm:contains assoc type. - * + * * @param child * @param parent */ protected void makePrimaryParentOf(NodeRef child, NodeRef parent) { - makePrimaryParentOf(child, parent, ContentModel.ASSOC_CONTAINS, generateQName()); - } - - protected void makePrimaryParentOf(NodeRef child, NodeRef parent, QName assocType, QName assocName) - { - makePrimaryParentOf(child, parent, assocType, assocName, mockedNodeService); - } - - protected void makePrimaryParentOf(NodeRef child, NodeRef parent, QName assocType, QName assocName, NodeService mockedNodeService) - { - doReturn(new ChildAssociationRef(assocType, parent, assocName, child)) + doReturn(new ChildAssociationRef(ContentModel.ASSOC_CONTAINS, parent, generateQName(), child)) .when(mockedNodeService) .getPrimaryParent(child); } - + /** * Helper method to make a number of nodes children of another. *

* Assumes the cm:contains assoc type. - * + * * @param parent * @param children */ @@ -425,11 +298,45 @@ public class BaseUnitTest implements RecordsManagementModel, ContentModel for (NodeRef child : children) { assocs.add(new ChildAssociationRef(ContentModel.ASSOC_CONTAINS, parent, generateQName(), child)); - doReturn(assocs).when(mockedNodeService).getParentAssocs(child); } + doReturn(assocs).when(mockedNodeService).getChildAssocs(parent, ContentModel.ASSOC_CONTAINS, RegexQNamePattern.MATCH_ALL); } - + + /** + * Helper method to mock up calls to 'run as' methods + * on base service implementation. + * + * @param service + */ + @SuppressWarnings("unchecked") + protected void mockRunAsMethods(ServiceBaseImpl service) + { + doAnswer(new Answer() + { + @SuppressWarnings("rawtypes") + @Override + public Object answer(InvocationOnMock invocation) throws Throwable + { + RunAsWork work = (RunAsWork)invocation.getArguments()[0]; + return work.doWork(); + } + + }).when(service).runAsSystem(any(RunAsWork.class)); + + doAnswer(new Answer() + { + @SuppressWarnings("rawtypes") + @Override + public Object answer(InvocationOnMock invocation) throws Throwable + { + RunAsWork work = (RunAsWork)invocation.getArguments()[0]; + return work.doWork(); + } + + }).when(service).runAs(any(RunAsWork.class), anyString()); + } + @SuppressWarnings("unchecked") protected List buildList(T ... values) { diff --git a/rm-server/unit-test/java/org/alfresco/module/org_alfresco_module_rm/util/BeanExtenderUnitTest.java b/rm-server/unit-test/java/org/alfresco/module/org_alfresco_module_rm/util/BeanExtenderUnitTest.java new file mode 100644 index 0000000000..5f2a932261 --- /dev/null +++ b/rm-server/unit-test/java/org/alfresco/module/org_alfresco_module_rm/util/BeanExtenderUnitTest.java @@ -0,0 +1,245 @@ +/* + * Copyright (C) 2005-2014 Alfresco Software Limited. + * + * This file is part of Alfresco + * + * Alfresco is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Alfresco is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + */ +package org.alfresco.module.org_alfresco_module_rm.util; + +import static org.mockito.Matchers.anyString; +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.never; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +import org.alfresco.module.org_alfresco_module_rm.test.util.BaseUnitTest; +import org.alfresco.util.GUID; +import org.junit.Test; +import org.mockito.InjectMocks; +import org.mockito.Mock; +import org.springframework.beans.MutablePropertyValues; +import org.springframework.beans.PropertyValue; +import org.springframework.beans.factory.NoSuchBeanDefinitionException; +import org.springframework.beans.factory.config.BeanDefinition; +import org.springframework.beans.factory.config.ConfigurableListableBeanFactory; + + +/** + * Bean extender unit test. + * + * @author Roy Wetherall + * @since 2.2 + */ +public class BeanExtenderUnitTest extends BaseUnitTest +{ + private static final String BEAN_NAME = GUID.generate(); + private static final String EXTENDING_BEAN_NAME = GUID.generate(); + + @Mock private ConfigurableListableBeanFactory mockedBeanFactory; + @Mock private BeanDefinition mockedBeanDefinition; + @Mock private BeanDefinition mockedExtendingBeanDefinition; + @Mock private MutablePropertyValues mockedPropertyValuesBean; + @Mock private MutablePropertyValues mockedPropertyValuesExtendingBean; + + @InjectMocks private BeanExtender beanExtender; + + @Override + public void before() + { + super.before(); + + // setup common interactions + doReturn(mockedPropertyValuesBean).when(mockedBeanDefinition).getPropertyValues(); + doReturn(mockedPropertyValuesExtendingBean).when(mockedExtendingBeanDefinition).getPropertyValues(); + } + + /** + * given that the bean name is not set, ensure that an Illegal Argument + * exception is thrown. + */ + @Test + public void beanNameNotSet() + { + // === given === + + // set the extending bean name + beanExtender.setExtendingBeanName(EXTENDING_BEAN_NAME); + + // expecting exception + exception.expect(IllegalArgumentException.class); + + // === when === + beanExtender.postProcessBeanFactory(mockedBeanFactory); + } + + /** + * given that the extending bean name is not set, ensure that an illegal + * argument exception is thrown. + */ + @Test + public void extendingBeanNameNotSet() + { + // === given === + + // set the extending bean name + beanExtender.setBeanName(BEAN_NAME); + + // expecting exception + exception.expect(IllegalArgumentException.class); + + // === when === + beanExtender.postProcessBeanFactory(mockedBeanFactory); + } + + /** + * given that the bean does not exist ensure that an exception is thrown + */ + @Test + public void beanDoesNotExist() + { + // === given === + + // set the bean names + beanExtender.setBeanName(BEAN_NAME); + beanExtender.setExtendingBeanName(EXTENDING_BEAN_NAME); + doReturn(false).when(mockedBeanFactory).containsBean(BEAN_NAME); + doReturn(true).when(mockedBeanFactory).containsBean(EXTENDING_BEAN_NAME); + + // expecting exception + exception.expect(NoSuchBeanDefinitionException.class); + + // === when === + beanExtender.postProcessBeanFactory(mockedBeanFactory); + } + + /** + * given that the extending bean does not exist ensure that an exception is thrown + */ + @Test + public void extendingBeanDoesNotExist() + { + // === given === + + // set the bean names + beanExtender.setBeanName(BEAN_NAME); + beanExtender.setExtendingBeanName(EXTENDING_BEAN_NAME); + doReturn(true).when(mockedBeanFactory).containsBean(BEAN_NAME); + doReturn(false).when(mockedBeanFactory).containsBean(EXTENDING_BEAN_NAME); + + // expecting exception + exception.expect(NoSuchBeanDefinitionException.class); + + // === when === + beanExtender.postProcessBeanFactory(mockedBeanFactory); + } + + /** + * given that a different class name has been set on the extending bean ensure it is + * set correctly on the origional bean + */ + @Test + public void beanClassNameSet() + { + // === given === + + // set the bean names + beanExtender.setBeanName(BEAN_NAME); + beanExtender.setExtendingBeanName(EXTENDING_BEAN_NAME); + + // both beans are available in the bean factory + doReturn(true).when(mockedBeanFactory).containsBean(BEAN_NAME); + doReturn(true).when(mockedBeanFactory).containsBean(EXTENDING_BEAN_NAME); + + // return the mocked bean definitions + doReturn(mockedBeanDefinition).when(mockedBeanFactory).getBeanDefinition(BEAN_NAME); + doReturn(mockedExtendingBeanDefinition).when(mockedBeanFactory).getBeanDefinition(EXTENDING_BEAN_NAME); + + // bean class names + doReturn("a").when(mockedBeanDefinition).getBeanClassName(); + doReturn("b").when(mockedExtendingBeanDefinition).getBeanClassName(); + + // no properties have been defined + doReturn(Collections.EMPTY_LIST).when(mockedPropertyValuesExtendingBean).getPropertyValueList(); + + // === when === + beanExtender.postProcessBeanFactory(mockedBeanFactory); + + // === then === + + // expect the class name to be set on the bean + verify(mockedBeanDefinition, times(1)).setBeanClassName("b"); + verify(mockedPropertyValuesBean, never()).add(anyString(), anyString()); + + } + + /** + * given that new property values have been set on the extending bean ensure that they + * are correctly set on the original bean. + */ + @Test + public void beanPropertyValuesSet() + { + // === given === + + // set the bean names + beanExtender.setBeanName(BEAN_NAME); + beanExtender.setExtendingBeanName(EXTENDING_BEAN_NAME); + + // both beans are available in the bean factory + doReturn(true).when(mockedBeanFactory).containsBean(BEAN_NAME); + doReturn(true).when(mockedBeanFactory).containsBean(EXTENDING_BEAN_NAME); + + // return the mocked bean definitions + doReturn(mockedBeanDefinition).when(mockedBeanFactory).getBeanDefinition(BEAN_NAME); + doReturn(mockedExtendingBeanDefinition).when(mockedBeanFactory).getBeanDefinition(EXTENDING_BEAN_NAME); + + // bean class names + doReturn("a").when(mockedBeanDefinition).getBeanClassName(); + doReturn(null).when(mockedExtendingBeanDefinition).getBeanClassName(); + + PropertyValue mockedPropertyValueOne = generateMockedPropertyValue("one", "1"); + PropertyValue mockedPropertyValueTwo = generateMockedPropertyValue("two", "2"); + List list = new ArrayList(2); + list.add(mockedPropertyValueOne); + list.add(mockedPropertyValueTwo); + doReturn(list).when(mockedPropertyValuesExtendingBean).getPropertyValueList(); + + // === when === + beanExtender.postProcessBeanFactory(mockedBeanFactory); + + // === then === + + // expect the class name to be set on the bean + verify(mockedBeanDefinition, never()).setBeanClassName(anyString()); + verify(mockedPropertyValuesBean, times(1)).add("one", "1"); + verify(mockedPropertyValuesBean, times(1)).add("two", "2"); + } + + /** + * Helper method to generate a mocked property value + */ + private PropertyValue generateMockedPropertyValue(String name, String value) + { + PropertyValue result = mock(PropertyValue.class); + doReturn(name).when(result).getName(); + doReturn(value).when(result).getValue(); + return result; + } +} diff --git a/rm-server/unit-test/java/org/alfresco/module/org_alfresco_module_rm/version/RecordableVersionServiceImplUnitTest.java b/rm-server/unit-test/java/org/alfresco/module/org_alfresco_module_rm/version/RecordableVersionServiceImplUnitTest.java deleted file mode 100644 index 21d590dd27..0000000000 --- a/rm-server/unit-test/java/org/alfresco/module/org_alfresco_module_rm/version/RecordableVersionServiceImplUnitTest.java +++ /dev/null @@ -1,498 +0,0 @@ -/* - * Copyright (C) 2005-2014 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - */ -package org.alfresco.module.org_alfresco_module_rm.version; - -import static org.mockito.Matchers.any; -import static org.mockito.Matchers.anyMap; -import static org.mockito.Matchers.anyString; -import static org.mockito.Matchers.eq; -import static org.mockito.Mockito.doReturn; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.never; -import static org.mockito.Mockito.times; -import static org.mockito.Mockito.verify; - -import java.io.Serializable; -import java.util.Collections; -import java.util.HashMap; -import java.util.Map; - -import org.alfresco.error.AlfrescoRuntimeException; -import org.alfresco.model.ContentModel; -import org.alfresco.module.org_alfresco_module_rm.fileplan.FilePlanService; -import org.alfresco.module.org_alfresco_module_rm.test.util.BaseUnitTest; -import org.alfresco.repo.version.Version2Model; -import org.alfresco.repo.version.VersionModel; -import org.alfresco.repo.version.common.VersionImpl; -import org.alfresco.service.cmr.model.FileInfo; -import org.alfresco.service.cmr.repository.ContentReader; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.repository.NodeService; -import org.alfresco.service.cmr.version.Version; -import org.alfresco.service.cmr.version.VersionType; -import org.alfresco.service.namespace.NamespaceService; -import org.alfresco.service.namespace.QName; -import org.junit.Test; -import org.mockito.InjectMocks; -import org.mockito.Mock; -import org.mockito.Spy; - -/** - * Recordable version service implementation unit test. - * - * @author Roy Wetherall - * @since 2.3 - */ -public class RecordableVersionServiceImplUnitTest extends BaseUnitTest -{ - /** versioned content name */ - private static final String CONTENT_NAME = "test.txt"; - - /** versioned node reference */ - private NodeRef nodeRef; - private NodeRef record; - private NodeRef unfiledRecordContainer; - private NodeRef version; - - /** mocked version properties */ - private Map versionProperties; - - /** mocked services */ - private @Mock(name="dbNodeService") NodeService mockedDbNodeService; - - /** recordable version service */ - private @InjectMocks @Spy TestRecordableVersionServiceImpl recordableVersionService; - - /** - * @see org.alfresco.module.org_alfresco_module_rm.test.util.BaseUnitTest#before() - */ - @SuppressWarnings("unchecked") - @Override - public void before() throws Exception - { - super.before(); - - nodeRef = generateCmContent(CONTENT_NAME); - doReturn(123l).when(mockedNodeService).getProperty(nodeRef, ContentModel.PROP_NODE_DBID); - - versionProperties = new HashMap(5); - - recordableVersionService.initialise(); - - doReturn(generateChildAssociationRef(null, generateNodeRef(Version2Model.TYPE_QNAME_VERSION_HISTORY))) - .when(mockedDbNodeService).createNode(any(NodeRef.class), - any(QName.class), - any(QName.class), - eq(Version2Model.TYPE_QNAME_VERSION_HISTORY), - anyMap()); - doReturn(generateChildAssociationRef(null, generateNodeRef(TYPE_CONTENT))) - .when(mockedDbNodeService).createNode(any(NodeRef.class), - any(QName.class), - any(QName.class), - eq(TYPE_CONTENT), - anyMap()); - - doReturn(filePlan).when(mockedFilePlanService).getFilePlanBySiteId(FilePlanService.DEFAULT_RM_SITE_ID); - doReturn(unfiledRecordContainer).when(mockedFilePlanService).getUnfiledContainer(any(NodeRef.class)); - - record = generateCmContent(CONTENT_NAME); - FileInfo mockedFileInfo = mock(FileInfo.class); - doReturn(record).when(mockedFileInfo).getNodeRef(); - doReturn(mockedFileInfo).when(mockedFileFolderService).copy(any(NodeRef.class), - any(NodeRef.class), - any(String.class)); - version = generateNodeRef(TYPE_CONTENT); - doReturn(generateChildAssociationRef(null, version)).when(mockedDbNodeService).createNode( - any(NodeRef.class), - eq(Version2Model.CHILD_QNAME_VERSIONS), - any(QName.class), - eq(TYPE_CONTENT), - anyMap()); - } - - /** - * Given that the node has no recordable version aspect - * When I create a version - * Then version service creates a normal version. - */ - @Test - public void noAspect() throws Exception - { - // setup given conditions - doReturn(false).when(mockedNodeService).hasAspect(nodeRef, RecordableVersionModel.ASPECT_VERSIONABLE); - versionProperties.put(VersionModel.PROP_VERSION_TYPE, VersionType.MINOR); - - // when version is created - recordableVersionService.createVersion(nodeRef, versionProperties); - - // then a normal version is created - verifyNormalVersion(); - } - - /** - * Given that the node has a recordable version policy of null - * When I create a version - * Then the version service creates a normal version. - */ - @Test - public void policyNull() throws Exception - { - // setup given conditions - doReturn(false).when(mockedNodeService).hasAspect(nodeRef, RecordableVersionModel.ASPECT_VERSIONABLE); - doReturn(null).when(mockedNodeService).getProperty(nodeRef, RecordableVersionModel.PROP_RECORDABLE_VERSION_POLICY); - versionProperties.put(VersionModel.PROP_VERSION_TYPE, VersionType.MINOR); - - // when version is created - recordableVersionService.createVersion(nodeRef, versionProperties); - - // then a normal version is created - verifyNormalVersion(); - } - - /** - * Given that the node has a recordable version policy of NONE - * When I create a version - * Then the version service creates a normal version. - */ - @Test - public void policyNone() throws Exception - { - // setup given conditions - doReturn(true).when(mockedNodeService).hasAspect(nodeRef, RecordableVersionModel.ASPECT_VERSIONABLE); - doReturn(RecordableVersionPolicy.NONE.toString()).when(mockedNodeService).getProperty(nodeRef, RecordableVersionModel.PROP_RECORDABLE_VERSION_POLICY); - versionProperties.put(VersionModel.PROP_VERSION_TYPE, VersionType.MINOR); - - // when version is created - recordableVersionService.createVersion(nodeRef, versionProperties); - - // then a normal version is created - verifyNormalVersion(); - } - - /** - * Given that the node has a recordable version policy of ALL - * When I create a MINOR version then - * the version service creates a recorded version - */ - @Test - public void policyAllVersionMinor() throws Exception - { - // setup given conditions - doReturn(true).when(mockedNodeService).hasAspect(nodeRef, RecordableVersionModel.ASPECT_VERSIONABLE); - doReturn(RecordableVersionPolicy.ALL.toString()).when(mockedNodeService).getProperty(nodeRef, RecordableVersionModel.PROP_RECORDABLE_VERSION_POLICY); - versionProperties.put(VersionModel.PROP_VERSION_TYPE, VersionType.MINOR); - - // when version is created - recordableVersionService.createVersion(nodeRef, versionProperties); - - // then the recorded version is created - verify(mockedRecordService, times(1)).createRecordFromCopy(filePlan, nodeRef); - } - - /** - * Helper method that verified that a recorded version was not created. - */ - @SuppressWarnings("unchecked") - private void verifyNormalVersion() throws Exception - { - // verify no interactions - verify(mockedFilePlanService, never()).getUnfiledContainer(any(NodeRef.class)); - verify(mockedFileFolderService, never()).copy(eq(nodeRef), - eq(unfiledRecordContainer), - anyString()); - - // then the version is created - verify(mockedDbNodeService, times(1)).createNode(any(NodeRef.class), - eq(Version2Model.CHILD_QNAME_VERSIONS), - any(QName.class), - eq(TYPE_CONTENT), - anyMap()); - verify(mockedNodeService, times(1)).addAspect(eq(version), eq(Version2Model.ASPECT_VERSION), anyMap()); - verify(mockedNodeService, never()).addAspect(eq(version), eq(RecordableVersionModel.PROP_RECORD_NODE_REF), anyMap()); - } - - /** - * Given that the node has a recordable version policy of ALL - * When I create a MAJOR version then - * the version service creates a recorded version - */ - @Test - public void policyAllVersionMajor() throws Exception - { - // setup given conditions - doReturn(true).when(mockedNodeService).hasAspect(nodeRef, RecordableVersionModel.ASPECT_VERSIONABLE); - doReturn(RecordableVersionPolicy.ALL.toString()).when(mockedNodeService).getProperty(nodeRef, RecordableVersionModel.PROP_RECORDABLE_VERSION_POLICY); - versionProperties.put(VersionModel.PROP_VERSION_TYPE, VersionType.MAJOR); - - // when version is created - recordableVersionService.createVersion(nodeRef, versionProperties); - - // then the recorded version is created - verify(mockedRecordService, times(1)).createRecordFromCopy(filePlan, nodeRef); - - } - - /** - * Given that the node has a recordable version policy of MAJOR_ONLY - * When I create a MINOR version then - * the version service creates a normal version - */ - @Test - public void policyMajorOnlyVersionMinor() throws Exception - { - // setup given conditions - doReturn(true).when(mockedNodeService).hasAspect(nodeRef, RecordableVersionModel.ASPECT_VERSIONABLE); - doReturn(RecordableVersionPolicy.MAJOR_ONLY.toString()).when(mockedNodeService).getProperty(nodeRef, RecordableVersionModel.PROP_RECORDABLE_VERSION_POLICY); - versionProperties.put(VersionModel.PROP_VERSION_TYPE, VersionType.MINOR); - - // when version is created - recordableVersionService.createVersion(nodeRef, versionProperties); - - // then a normal version is created - verifyNormalVersion(); - } - - /** - * Given that the node has a recordable version policy of MAJOR_ONLY - * When I create a MAJOR version then - * the version service creates a recorded version - */ - @Test - public void policyMajorOnlyVersionMajor() throws Exception - { - // setup given conditions - doReturn(true).when(mockedNodeService).hasAspect(nodeRef, RecordableVersionModel.ASPECT_VERSIONABLE); - doReturn(RecordableVersionPolicy.MAJOR_ONLY.toString()).when(mockedNodeService).getProperty(nodeRef, RecordableVersionModel.PROP_RECORDABLE_VERSION_POLICY); - versionProperties.put(VersionModel.PROP_VERSION_TYPE, VersionType.MAJOR); - - // when version is created - recordableVersionService.createVersion(nodeRef, versionProperties); - - // then the recorded version is created - verify(mockedRecordService, times(1)).createRecordFromCopy(filePlan, nodeRef); - } - - /** - * Given that the node has a valid recordable version policy - * And there is no file plan - * When I create a new version - * Then an exception should be thrown to indicate that there is no file plan - */ - @Test - public void noFilePlan() throws Exception - { - // setup given conditions - doReturn(true).when(mockedNodeService).hasAspect(nodeRef, RecordableVersionModel.ASPECT_VERSIONABLE); - doReturn(RecordableVersionPolicy.MAJOR_ONLY.toString()).when(mockedNodeService).getProperty(nodeRef, RecordableVersionModel.PROP_RECORDABLE_VERSION_POLICY); - versionProperties.put(VersionModel.PROP_VERSION_TYPE, VersionType.MAJOR); - doReturn(null).when(mockedFilePlanService).getFilePlanBySiteId(FilePlanService.DEFAULT_RM_SITE_ID); - - // expected exception - exception.expect(AlfrescoRuntimeException.class); - - // when version is created - recordableVersionService.createVersion(nodeRef, versionProperties); - } - - /** - * Given that the node has a valid recordable version policy - * And that I set a specific file plan in the version properties - * When I create a new version - * Then the recorded version should be directed to the specified file plan, not the default file plan - */ - @Test - public void filePlanSpecifiedWithPolicy() throws Exception - { - // setup given conditions - doReturn(true).when(mockedNodeService).hasAspect(nodeRef, RecordableVersionModel.ASPECT_VERSIONABLE); - doReturn(RecordableVersionPolicy.MAJOR_ONLY.toString()).when(mockedNodeService).getProperty(nodeRef, RecordableVersionModel.PROP_RECORDABLE_VERSION_POLICY); - versionProperties.put(VersionModel.PROP_VERSION_TYPE, VersionType.MAJOR); - - // specify the file plan - NodeRef anotherFilePlan = generateNodeRef(TYPE_FILE_PLAN); - versionProperties.put(RecordableVersionServiceImpl.KEY_FILE_PLAN, anotherFilePlan); - - // when version is created - recordableVersionService.createVersion(nodeRef, versionProperties); - - // then the recorded version is created - verify(mockedRecordService, times(0)).createRecordFromCopy(filePlan, nodeRef); - } - - /** - * Given that the node has specifically indicated that a recorded version should be created - * And that I set a specific file plan in the version properties - * When I create a new version - * Then the recorded version should be directed to the specified file plan, not the default file plan - */ - @Test - public void filePlanSpecifiedNoPolicy() throws Exception - { - // setup given conditions - doReturn(true).when(mockedNodeService).hasAspect(nodeRef, RecordableVersionModel.ASPECT_VERSIONABLE); - versionProperties.put(VersionModel.PROP_VERSION_TYPE, VersionType.MAJOR); - versionProperties.put(RecordableVersionServiceImpl.KEY_RECORDABLE_VERSION, true); - - // specify the file plan - NodeRef anotherFilePlan = generateNodeRef(TYPE_FILE_PLAN); - versionProperties.put(RecordableVersionServiceImpl.KEY_FILE_PLAN, anotherFilePlan); - - // when version is created - recordableVersionService.createVersion(nodeRef, versionProperties); - - // then the recorded version is created - verify(mockedRecordService, times(0)).createRecordFromCopy(filePlan, nodeRef); - } - - @Test - public void adHocRecordedVersionNoPolicy() throws Exception - { - // setup given conditions - doReturn(true).when(mockedNodeService).hasAspect(nodeRef, RecordableVersionModel.ASPECT_VERSIONABLE); - versionProperties.put(VersionModel.PROP_VERSION_TYPE, VersionType.MAJOR); - versionProperties.put(RecordableVersionServiceImpl.KEY_RECORDABLE_VERSION, true); - - // when version is created - recordableVersionService.createVersion(nodeRef, versionProperties); - - // then the recorded version is created - verify(mockedRecordService, times(1)).createRecordFromCopy(filePlan, nodeRef); - } - - @Test - public void adHocRecordedVersionOverridePolicy() throws Exception - { - // setup given conditions - doReturn(true).when(mockedNodeService).hasAspect(nodeRef, RecordableVersionModel.ASPECT_VERSIONABLE); - doReturn(RecordableVersionPolicy.MAJOR_ONLY.toString()).when(mockedNodeService).getProperty(nodeRef, RecordableVersionModel.PROP_RECORDABLE_VERSION_POLICY); - versionProperties.put(VersionModel.PROP_VERSION_TYPE, VersionType.MINOR); - versionProperties.put(RecordableVersionServiceImpl.KEY_RECORDABLE_VERSION, true); - - // when version is created - recordableVersionService.createVersion(nodeRef, versionProperties); - - // then the recorded version is created - verify(mockedRecordService, times(1)).createRecordFromCopy(filePlan, nodeRef); - } - - /** - * Given that a node is not versionable - * When I try and create a record from the latest version - * Then nothing will happen, because there is not version to record - */ - @Test - public void notVersionableCreateRecordFromVersion() - { - // content node is not versionable - doReturn(false).when(mockedNodeService).hasAspect(nodeRef, ContentModel.ASPECT_VERSIONABLE); - - // create record from version - recordableVersionService.createRecordFromLatestVersion(filePlan, nodeRef); - - // nothing happens - verify(mockedRecordService, never()).createRecordFromCopy(eq(filePlan), any(NodeRef.class)); - } - - /** - * Given that a nodes last version is recorded - * When I try and create a record from the latest version - * Then nothing will happen, because the latest version is already recorded - */ - @Test - public void alreadyRecordedCreateRecordFromVersion() - { - // latest version is already recorded - Version mockedVersion = mock(VersionImpl.class); - doReturn(Collections.singletonMap(RecordableVersionServiceImpl.PROP_VERSION_RECORD, generateNodeRef())).when(mockedVersion).getVersionProperties(); - doReturn(true).when(mockedNodeService).hasAspect(nodeRef, ContentModel.ASPECT_VERSIONABLE); - doReturn(mockedVersion).when(recordableVersionService).getCurrentVersion(nodeRef); - - // create record from version - recordableVersionService.createRecordFromLatestVersion(filePlan, nodeRef); - - // nothing happens - verify(mockedRecordService, never()).createRecordFromCopy(eq(filePlan), any(NodeRef.class)); - } - - /** - * Given that a nodes last version is not recorded - * When I try to create a record from the latest version - * Then the latest version is marked as record and a new record version is created to store the version state - */ - @SuppressWarnings("unchecked") - @Test - public void notRecordedCreateRecordFromVersion() - { - // latest version is not recorded - Version mockedVersion = mock(VersionImpl.class); - NodeRef versionNodeRef = generateNodeRef(); - doReturn(Collections.emptyMap()).when(mockedVersion).getVersionProperties(); - doReturn(true).when(mockedNodeService).hasAspect(nodeRef, ContentModel.ASPECT_VERSIONABLE); - - // version history - NodeRef versionHistoryNodeRef = generateNodeRef(); - doReturn(versionHistoryNodeRef).when(mockedDbNodeService).getChildByName(any(NodeRef.class), eq(Version2Model.CHILD_QNAME_VERSION_HISTORIES), any(String.class)); - - // version number - doReturn(mockedVersion).when(recordableVersionService).getCurrentVersion(nodeRef); - doReturn(versionNodeRef).when(recordableVersionService).convertNodeRef(any(NodeRef.class)); - makePrimaryParentOf(versionNodeRef, versionHistoryNodeRef, ContentModel.ASSOC_CONTAINS, QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, "something-0"), mockedDbNodeService); - - // created version - NodeRef newVersionNodeRef = generateNodeRef(); - doReturn(generateChildAssociationRef(versionHistoryNodeRef, newVersionNodeRef)).when(mockedDbNodeService).createNode( - eq(versionHistoryNodeRef), - eq(Version2Model.CHILD_QNAME_VERSIONS), - any(QName.class), - any(QName.class), - any(Map.class)); - - // created record - NodeRef newRecordNodeRef = generateNodeRef(); - doReturn(newRecordNodeRef).when(mockedRecordService).createRecordFromContent( - eq(filePlan), - any(String.class), - any(QName.class), - any(Map.class), - any(ContentReader.class)); - - // create record from version - recordableVersionService.createRecordFromLatestVersion(filePlan, nodeRef); - - // verify that the version is converted to a recorded version - verify(mockedRecordService, times(1)).createRecordFromContent( - eq(filePlan), - any(String.class), - any(QName.class), - any(Map.class), - any(ContentReader.class)); - verify(mockedDbNodeService, times(1)).deleteNode(any(NodeRef.class)); - verify(mockedDbNodeService, times(1)).createNode( - eq(versionHistoryNodeRef), - eq(Version2Model.CHILD_QNAME_VERSIONS), - any(QName.class), - any(QName.class), - any(Map.class)); - verify(mockedNodeService, times(1)).addAspect(eq(newVersionNodeRef), eq(Version2Model.ASPECT_VERSION), any(Map.class)); - verify(mockedNodeService, times(1)).addAspect( - newVersionNodeRef, - RecordableVersionModel.ASPECT_RECORDED_VERSION, - Collections.singletonMap(RecordableVersionModel.PROP_RECORD_NODE_REF, (Serializable)newRecordNodeRef)); - } -} \ No newline at end of file diff --git a/rm-server/unit-test/java/org/alfresco/module/org_alfresco_module_rm/version/TestRecordableVersionServiceImpl.java b/rm-server/unit-test/java/org/alfresco/module/org_alfresco_module_rm/version/TestRecordableVersionServiceImpl.java deleted file mode 100644 index 69cad5317d..0000000000 --- a/rm-server/unit-test/java/org/alfresco/module/org_alfresco_module_rm/version/TestRecordableVersionServiceImpl.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright (C) 2005-2014 Alfresco Software Limited. - * - * This file is part of Alfresco - * - * Alfresco is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Alfresco is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with Alfresco. If not, see . - */ -package org.alfresco.module.org_alfresco_module_rm.version; - -import java.io.Serializable; -import java.util.Map; - -import org.alfresco.repo.policy.PolicyScope; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.cmr.version.Version; -import org.alfresco.service.namespace.QName; - -/** - * Helper class to help with the unit testing of RecordableVersionServiceImpl. - * - * @author Roy Wetherall - * @since 2.3 - */ -public class TestRecordableVersionServiceImpl extends RecordableVersionServiceImpl -{ - @Override - protected void invokeBeforeCreateVersion(NodeRef nodeRef) - { - } - - @Override - protected void invokeAfterCreateVersion(NodeRef nodeRef, Version version) - { - } - - @Override - protected void invokeAfterVersionRevert(NodeRef nodeRef, Version version) - { - } - - @Override - protected void invokeOnCreateVersion(NodeRef nodeRef, Map versionProperties,PolicyScope nodeDetails) - { - } - - @Override - protected String invokeCalculateVersionLabel(QName classRef, Version preceedingVersion, int versionNumber, Map versionProperties) - { - return "1.1"; - } -} \ No newline at end of file